Re: [whatwg/dom] Validating a qualified name does not match browsers in a corner case (#319)

So... at least in terms of what Gecko is actually doing, it's validating the qualifiedname in "namespace aware" mode.  In that mode, we treat the char right after the ':' (if there is a ':') as a "name start" character, and '0' is not valid "name start" character.  In particular, we effectively treat the parts before and after the ':' symmetrically, in terms of treating a digit starting either one as an "invalid character" error.  This allows validation of the name in a single scan of it, just resetting some state if a ':' is found.

OK, so back to the spec...  The spec requires scanning the name twice, right?  This is somewhat easier to spec, but less efficient, of course.

We could try to rewrite our validation algorithm to produce the output the spec expects while staying to a single pass, but that code is a bit fiddly, so this would have nontrivial regression risk in practice.

As far as whether the spec is "right"... it's not obvious to me why you consider it "right".  It could be rewritten in terms of a slightly more complicated (in spec terms) but simpler to implement as a single pass validation algorithm, and such an algorithm may naturally treat a localName following a ':' but not matching the NCName production because it doesn't start with NameStartChar as being an invalid char err, not a namespace err, because it's not at all a namespace error, afaict.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/319#issuecomment-257203728

Received on Monday, 31 October 2016 02:53:12 UTC