-
Notifications
You must be signed in to change notification settings - Fork 24
DOMException with an unclosed attribute #68
Comments
Related issue that causes a DOM exception due to a colon in what's interpreted as a class name: <strong class:"apples">apples</strong> |
yeah those look like cases slowparse doesn't trip on atm. The first will be rather tricky, since technically the first detectable error in your example code is that http://... is not a valid attribute name, so it should be breaking there. Unfortunately, while super obvious to humans, that missing quote symbol is followed by pretty much 100% legal attribute content. Worth thinking about, but will be hard to deal with. The second case should already be caught so if it's not, let's add a unit test and fix it. Colons are not allowed in attribute names so that should have been flagged. |
I ran into |
we're doing a sprint on some unrelated code this week so I won't have time to look at it, but I can definitely point you at where things could be fixed: the trick here is that technically Another thing we could do is check to make sure that IF it's a legal namespace, the subsequent character is a valid word character; in this case the next character is a double quote, which would cause an error. It's probably worth first adding a test for this to the battery of tests over in https://github.com/mozilla/slowparse/blob/gh-pages/test/test-slowparse.js with your code, and a requirement that slowpase should fail on it, so that it becomes easier to figure out which code that tests "travels through". |
With HTML like this:
The following error occurs:
"Failed to execute 'createAttribute' on 'Document': The qualified name provided ('https:') has an empty local name."
That is because it thinks that the quote sign ends the attribute, and thus the thing after it, https, is an attribute name, and then I think it confuses it with a namespaced tag due to the colon.
It would be nice if it could fail better if possible.
On Thimble, this results in a silent error, by the way. On KA, we are catching this and outputting "Something's wrong with the HTML, but we're not sure what."
The text was updated successfully, but these errors were encountered: