Closed Bug 1286321 Opened 8 years ago Closed 8 years ago

script element: language attribute overrides type attribute when type is empty string

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla50
Tracking Status
firefox50 --- fixed

People

(Reporter: deckycoss, Assigned: deckycoss)

Details

Attachments

(1 file)

according to the HTML standard, when a script element contains both a type attribute and a language attribute, the latter must be ignored, even if the value of the former is the empty string. (see step 6: https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script)

however, this test shows that the language attribute is used when the type is set to the empty string: http://w3c-test.org/html/semantics/scripting-1/the-script-element/script-language-type.html
Comment on attachment 8771021 [details]
Bug 1286321: always ignore language attribute when processing script element if type attribute is defined;

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/64280/diff/1-2/
Would it make sense to just have GetScriptType return a boolean indicating whether there is an actual type?  That way you don't have to walk the attributes twice...
(In reply to Boris Zbarsky [:bz] from comment #3)
> Would it make sense to just have GetScriptType return a boolean indicating
> whether there is an actual type?  That way you don't have to walk the
> attributes twice...

i wondered about that too. maybe GetScriptType can call GetAttr directly instead of calling GetType?
Indeed.  And then GetType() can call GetScriptType if we want to avoid the code duplication.
Comment on attachment 8771021 [details]
Bug 1286321: always ignore language attribute when processing script element if type attribute is defined;

Redirecting to Boris since he has opinions here.
Attachment #8771021 - Flags: review?(bkelly) → review?(bzbarsky)
Comment on attachment 8771021 [details]
Bug 1286321: always ignore language attribute when processing script element if type attribute is defined;

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/64280/diff/2-3/
Attachment #8771021 - Flags: review?(bzbarsky) → review+
Comment on attachment 8771021 [details]
Bug 1286321: always ignore language attribute when processing script element if type attribute is defined;

https://reviewboard.mozilla.org/r/64280/#review61360

::: dom/base/nsIScriptElement.h:55
(Diff revision 3)
>  
>    /**
>     * Content type identifying the scripting language. Can be empty, in
>     * which case javascript will be assumed.
>     */
> -  virtual void GetScriptType(nsAString& type) = 0;
> +  virtual bool GetScriptType(nsAString& type) = 0;

Please document what the return value means.

r=me
Comment on attachment 8771021 [details]
Bug 1286321: always ignore language attribute when processing script element if type attribute is defined;

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/64280/diff/3-4/
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/264ffcf6eb58
always ignore language attribute when processing script element if type attribute is defined. r=bz
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/264ffcf6eb58
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: