This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24135 - form[name] non-normative text inconsistent
Summary: form[name] non-normative text inconsistent
Status: RESOLVED WORKSFORME
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-19 10:17 UTC by sof
Modified: 2014-03-07 23:53 UTC (History)
3 users (show)

See Also:


Attachments

Description sof 2013-12-19 10:17:42 UTC
The non-normative text for form[name] in

 http://www.whatwg.org/specs/web-apps/current-work/#the-form-element

states that only <img> elements with the given ID can match. I believe this should be by ID or name.
Comment 1 Ian 'Hixie' Hickson 2014-01-02 20:40:05 UTC
Do you have a test demonstrating this? I'm not 100% sure I follow.
Comment 2 sof 2014-01-02 21:05:20 UTC
Certainly,

 <form><img name="n"/></form><script>alert(document.forms[0]["n"]);</script>

Per that non-normative text afaict, the <img/> won't match.

(I'm assuming the "Returns the form control" part of that text to refer to the 'listed elements' of the form. Which does not have <img/>.)
Comment 3 Ian 'Hixie' Hickson 2014-01-04 22:10:15 UTC
Ah, I see. Yeah, that's intentional. The non-normative text ignores what happens for non-normative content. <img name> is non-normative.
Comment 4 sof 2014-01-05 07:10:24 UTC
That doesn't make much sense :-) Where is <img name> called out as being outside of what the spec requires when the algorithms below (in normative text) includes it, but without stating that it is not a requirement to also consider <img name>?
I would expect the non-normative box to be a summary of normative text, at least here.

(A trifling detail given that the text isn't normative, but still.)
Comment 5 Ian 'Hixie' Hickson 2014-01-09 19:02:51 UTC
(In reply to sof from comment #4)
> Where is <img name> called out as being
> outside of what the spec requires when the algorithms below (in normative
> text) includes it, but without stating that it is not a requirement to also
> consider <img name>?

I don't understand that question.

The idea is that implementors refer to the normative text to implement browsers, and authors refer to the non-normative text when figuring out how the APIs work.

Authors don't need to know anything about what happens with <img name>, since if they're using it they've probably made a mistake, and the validator will help them to convert to using id="" or whatnot. So the non-normative text doesn't mention it. This is one of the main ways the non-normative API descriptions differ from the normative ones; if the non-normative text were pedantically correct, it might as well be normative.
Comment 6 sof 2014-01-09 20:29:03 UTC
A problem here is/was how the line between normative and not is drawn (where is that defined); just trust the non-normative text as always being accurate?

But I now see that 

 http://www.whatwg.org/specs/web-apps/current-work/#non-conforming-features

enumerates img.name as obsolete. So, we're fine in this regard.
Comment 7 Ian 'Hixie' Hickson 2014-03-07 23:53:17 UTC
(In reply to sof from comment #6)
> A problem here is/was how the line between normative and not is drawn (where
> is that defined); just trust the non-normative text as always being accurate?

As an implementors, you should just ignore the non-normative text entirely. Especially the domintro blocks, but also anything that says "Note:", to be honest.
Comment 8 Ian 'Hixie' Hickson 2014-03-07 23:53:55 UTC
And definitely ignore all the examples. And the diagrams. And the text in the indexes, and any tables marked non-normative, and... :-)