Comparing version 0.3.5 to 0.4.0
@@ -54,3 +54,4 @@ // wrapper for non-node envs | ||
parser.opt = opt || {} | ||
parser.tagCase = parser.opt.lowercasetags ? "toLowerCase" : "toUpperCase" | ||
parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags; | ||
parser.looseCase = parser.opt.lowercase ? "toLowerCase" : "toUpperCase" | ||
parser.tags = [] | ||
@@ -138,3 +139,2 @@ parser.closed = parser.closedRoot = parser.sawRoot = false | ||
, close: function () { return this.write(null) } | ||
, end: function () { return this.write(null) } | ||
} | ||
@@ -370,3 +370,3 @@ | ||
function newTag (parser) { | ||
if (!parser.strict) parser.tagName = parser.tagName[parser.tagCase]() | ||
if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]() | ||
var parent = parser.tags[parser.tags.length - 1] || parser | ||
@@ -396,2 +396,3 @@ , tag = parser.tag = { name : parser.tagName, attributes : {} } | ||
function attrib (parser) { | ||
if (!parser.strict) parser.attribName = parser.attribName[parser.looseCase]() | ||
if (parser.opt.xmlns) { | ||
@@ -521,3 +522,3 @@ var qn = qname(parser.attribName) | ||
var tagName = parser.tagName | ||
if (!parser.strict) tagName = tagName[parser.tagCase]() | ||
if (!parser.strict) tagName = tagName[parser.looseCase]() | ||
var closeTo = tagName | ||
@@ -524,0 +525,0 @@ while (t --) { |
{ "name" : "sax" | ||
, "description": "An evented streaming XML parser in JavaScript" | ||
, "author" : "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)" | ||
, "version" : "0.3.5" | ||
, "version" : "0.4.0" | ||
, "main" : "lib/sax.js" | ||
@@ -6,0 +6,0 @@ , "license" : { "type": "MIT" |
@@ -101,4 +101,4 @@ # sax js | ||
space. | ||
* `lowercasetags` - Boolean. If true, then lowercase tags in loose mode, | ||
rather than uppercasing them. | ||
* `lowercase` - Boolean. If true, then lowercase tag names and attribute names | ||
in loose mode, rather than uppercasing them. | ||
* `xmlns` - Boolean. If true, then namespaces are supported. | ||
@@ -168,3 +168,3 @@ | ||
`opentag` - An opening tag. Argument: object with `name` and `attributes`. | ||
In non-strict mode, tag names are uppercased, unless the `lowercasetags` | ||
In non-strict mode, tag names are uppercased, unless the `lowercase` | ||
option is set. If the `xmlns` option is set, then it will contain | ||
@@ -179,4 +179,6 @@ namespace binding information on the `ns` member, and will have a | ||
`attribute` - An attribute node. Argument: object with `name` and `value`, | ||
and also namespace information if the `xmlns` option flag is set. | ||
`attribute` - An attribute node. Argument: object with `name` and `value`. | ||
In non-strict mode, attribute names are uppercased, unless the `lowercase` | ||
option is set. If the `xmlns` option is set, it will also contains namespace | ||
information. | ||
@@ -183,0 +185,0 @@ `comment` - A comment node. Argument: the string of the comment. |
@@ -7,6 +7,6 @@ // unquoted attributes should be ok in non-strict mode | ||
, expect : | ||
[ [ "attribute", { name: "class", value: "test" } ] | ||
, [ "attribute", { name: "hello", value: "world" } ] | ||
[ [ "attribute", { name: "CLASS", value: "test" } ] | ||
, [ "attribute", { name: "HELLO", value: "world" } ] | ||
, [ "opentag", { name: "SPAN", | ||
attributes: { class: "test", hello: "world" } } ] | ||
attributes: { CLASS: "test", HELLO: "world" } } ] | ||
, [ "closetag", "SPAN" ] | ||
@@ -13,0 +13,0 @@ ] |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
437891
44
1877
216
1
36