diff --git a/src/__fixtures__/Events/07-self-closing.json b/src/__fixtures__/Events/07-self-closing.json index d3d1c339..eda76c9e 100644 --- a/src/__fixtures__/Events/07-self-closing.json +++ b/src/__fixtures__/Events/07-self-closing.json @@ -1,6 +1,6 @@ { "name": "Self-closing tags", - "input": "Foo
", + "input": "Foo

", "expected": [ { "event": "opentagname", @@ -55,6 +55,72 @@ "startIndex": 32, "endIndex": 38, "data": ["hr", true] + }, + { + "event": "opentagname", + "startIndex": 39, + "endIndex": 45, + "data": ["break"] + }, + { + "event": "opentag", + "startIndex": 39, + "endIndex": 47, + "data": ["break", {}, false] + }, + { + "event": "opentagname", + "startIndex": 48, + "endIndex": 51, + "data": ["br"] + }, + { + "event": "opentag", + "startIndex": 48, + "endIndex": 52, + "data": ["br", {}, false] + }, + { + "event": "closetag", + "startIndex": 48, + "endIndex": 52, + "data": ["br", true] + }, + { + "event": "opentagname", + "startIndex": 53, + "endIndex": 57, + "data": ["img"] + }, + { + "event": "attribute", + "startIndex": 58, + "endIndex": 73, + "data": ["src", "w3html.gif", "'"] + }, + { + "event": "opentag", + "startIndex": 53, + "endIndex": 75, + "data": [ + "img", + { + "src": "w3html.gif" + }, + false + ] + }, + { + "event": "closetag", + "startIndex": 53, + "endIndex": 75, + "data": ["img", true] + }, + { + "event": "closetag", + "startIndex": 76, + "endIndex": 76, + "data": ["break", true] } ] } diff --git a/src/__fixtures__/Events/07b-self-closing.json b/src/__fixtures__/Events/07b-self-closing.json new file mode 100644 index 00000000..c7bd919f --- /dev/null +++ b/src/__fixtures__/Events/07b-self-closing.json @@ -0,0 +1,131 @@ +{ + "name": "Self-closing tags (recognizeSelfClosing=true)", + "input": "Foo

", + "options": { + "parser": { + "recognizeSelfClosing": true + } + }, + "expected": [ + { + "event": "opentagname", + "startIndex": 0, + "endIndex": 2, + "data": ["a"] + }, + { + "event": "attribute", + "startIndex": 3, + "endIndex": 24, + "data": ["href", "http://test.com/", null] + }, + { + "event": "opentag", + "startIndex": 0, + "endIndex": 24, + "data": [ + "a", + { + "href": "http://test.com/" + }, + false + ] + }, + { + "event": "text", + "startIndex": 25, + "endIndex": 27, + "data": ["Foo"] + }, + { + "event": "closetag", + "startIndex": 28, + "endIndex": 31, + "data": ["a", false] + }, + { + "event": "opentagname", + "startIndex": 32, + "endIndex": 35, + "data": ["hr"] + }, + { + "event": "opentag", + "startIndex": 32, + "endIndex": 38, + "data": ["hr", {}, false] + }, + { + "event": "closetag", + "startIndex": 32, + "endIndex": 38, + "data": ["hr", true] + }, + { + "event": "opentagname", + "startIndex": 39, + "endIndex": 45, + "data": ["break"] + }, + { + "event": "opentag", + "startIndex": 39, + "endIndex": 47, + "data": ["break", {}, false] + }, + { + "event": "closetag", + "startIndex": 39, + "endIndex": 47, + "data": ["break", true] + }, + { + "event": "opentagname", + "startIndex": 48, + "endIndex": 51, + "data": ["br"] + }, + { + "event": "opentag", + "startIndex": 48, + "endIndex": 52, + "data": ["br", {}, false] + }, + { + "event": "closetag", + "startIndex": 48, + "endIndex": 52, + "data": ["br", true] + }, + { + "event": "opentagname", + "startIndex": 53, + "endIndex": 57, + "data": ["img"] + }, + { + "event": "attribute", + "startIndex": 58, + "endIndex": 73, + "data": ["src", "w3html.gif", "'"] + }, + { + "event": "opentag", + "startIndex": 53, + "endIndex": 75, + "data": [ + "img", + { + "src": "w3html.gif" + }, + false + ] + }, + { + "event": "closetag", + "startIndex": 53, + "endIndex": 75, + "data": ["img", true] + } + ] +} diff --git a/src/__fixtures__/Events/35-non-br-void-close-tag.json b/src/__fixtures__/Events/35-non-br-void-close-tag.json index 4bb7c0ee..3863ed23 100644 --- a/src/__fixtures__/Events/35-non-br-void-close-tag.json +++ b/src/__fixtures__/Events/35-non-br-void-close-tag.json @@ -1,6 +1,6 @@ { "name": "open-implies-close case of (non-br) void close tag in non-XML mode", - "input": "", + "input": "
", "options": { "parser": { "lowerCaseAttributeNames": true @@ -42,6 +42,24 @@ "startIndex": 8, "endIndex": 14, "data": ["input", true] + }, + { + "event": "opentagname", + "startIndex": 15, + "endIndex": 18, + "data": ["br"] + }, + { + "event": "opentag", + "startIndex": 15, + "endIndex": 18, + "data": ["br", {}, false] + }, + { + "event": "closetag", + "startIndex": 15, + "endIndex": 18, + "data": ["br", true] } ] }