Commit 7f241e07 authored by tkent@chromium.org's avatar tkent@chromium.org

Correct handling of |for| and |event| attributes of script elements.

https://html.spec.whatwg.org/multipage/scripting.html#script-processing-for
> 12. If the script element has an event attribute and a for attribute, then run
> these substeps:

Our implementation was "... has a non-empty event attribute and a non-empty for
attribute, ...".  This CL corrects isEmpty() checks to isNull().
The new behavior is compatible with IE and Firefox.

BUG=520844

Review URL: https://codereview.chromium.org/1305213005

git-svn-id: svn://svn.chromium.org/blink/trunk@201627 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 98864def
...@@ -394,9 +394,6 @@ crbug.com/508725 imported/web-platform-tests/html/semantics/forms/textfieldselec ...@@ -394,9 +394,6 @@ crbug.com/508725 imported/web-platform-tests/html/semantics/forms/textfieldselec
crbug.com/490511 imported/web-platform-tests/html/semantics/text-level-semantics/the-wbr-element/wbr-element.html [ ImageOnlyFailure ] crbug.com/490511 imported/web-platform-tests/html/semantics/text-level-semantics/the-wbr-element/wbr-element.html [ ImageOnlyFailure ]
crbug.com/490511 imported/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLTrackElement/src.html [ Failure ] crbug.com/490511 imported/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLTrackElement/src.html [ Failure ]
crbug.com/526920 imported/web-platform-tests/html/semantics/embedded-content/media-elements/location-of-the-media-resource/currentSrc.html [ Failure ] crbug.com/526920 imported/web-platform-tests/html/semantics/embedded-content/media-elements/location-of-the-media-resource/currentSrc.html [ Failure ]
# script-for-event.html: We can't check in failure results because we also have
# script-for-event.xhtml.
crbug.com/520844 imported/web-platform-tests/html/semantics/scripting-1/the-script-element/script-for-event.html [ Failure ]
crbug.com/525889 imported/web-platform-tests/html/webappapis/scripting/processing-model-2/compile-error-in-setInterval.html [ Failure ] crbug.com/525889 imported/web-platform-tests/html/webappapis/scripting/processing-model-2/compile-error-in-setInterval.html [ Failure ]
crbug.com/525889 imported/web-platform-tests/html/webappapis/scripting/processing-model-2/compile-error-in-setTimeout.html [ Failure ] crbug.com/525889 imported/web-platform-tests/html/webappapis/scripting/processing-model-2/compile-error-in-setTimeout.html [ Failure ]
crbug.com/525889 imported/web-platform-tests/html/webappapis/scripting/processing-model-2/runtime-error-in-setInterval.html [ Failure ] crbug.com/525889 imported/web-platform-tests/html/webappapis/scripting/processing-model-2/runtime-error-in-setInterval.html [ Failure ]
......
...@@ -482,16 +482,14 @@ bool ScriptLoader::isScriptForEventSupported() const ...@@ -482,16 +482,14 @@ bool ScriptLoader::isScriptForEventSupported() const
{ {
String eventAttribute = client()->eventAttributeValue(); String eventAttribute = client()->eventAttributeValue();
String forAttribute = client()->forAttributeValue(); String forAttribute = client()->forAttributeValue();
if (!eventAttribute.isEmpty() && !forAttribute.isEmpty()) { if (eventAttribute.isNull() || forAttribute.isNull())
forAttribute = forAttribute.stripWhiteSpace(); return true;
if (!equalIgnoringCase(forAttribute, "window"))
return false;
eventAttribute = eventAttribute.stripWhiteSpace(); forAttribute = forAttribute.stripWhiteSpace();
if (!equalIgnoringCase(eventAttribute, "onload") && !equalIgnoringCase(eventAttribute, "onload()")) if (!equalIgnoringCase(forAttribute, "window"))
return false; return false;
} eventAttribute = eventAttribute.stripWhiteSpace();
return true; return equalIgnoringCase(eventAttribute, "onload") || equalIgnoringCase(eventAttribute, "onload()");
} }
String ScriptLoader::scriptContent() const String ScriptLoader::scriptContent() const
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment