mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:07:35 +00:00
LibWeb: Tweak for/event whitespace stripping in <script> to match spec
This is not a functional change, it merely reorders operations so that we match spec language better.
This commit is contained in:
parent
917725ce67
commit
b8d683c5fb
1 changed files with 7 additions and 4 deletions
|
@ -196,11 +196,14 @@ void HTMLScriptElement::prepare_script()
|
||||||
// 16. If the script element has an event attribute and a for attribute, and the script's type is "classic", then:
|
// 16. If the script element has an event attribute and a for attribute, and the script's type is "classic", then:
|
||||||
if (m_script_type == ScriptType::Classic && has_attribute(HTML::AttributeNames::event) && has_attribute(HTML::AttributeNames::for_)) {
|
if (m_script_type == ScriptType::Classic && has_attribute(HTML::AttributeNames::event) && has_attribute(HTML::AttributeNames::for_)) {
|
||||||
// 1. Let for be the value of the for attribute.
|
// 1. Let for be the value of the for attribute.
|
||||||
auto for_ = attribute(HTML::AttributeNames::for_).trim_whitespace();
|
auto for_ = attribute(HTML::AttributeNames::for_);
|
||||||
// 2. Let event be the value of the event attribute.
|
|
||||||
auto event = attribute(HTML::AttributeNames::event).trim_whitespace();
|
|
||||||
|
|
||||||
// FIXME: 3. Strip leading and trailing ASCII whitespace from event and for.
|
// 2. Let event be the value of the event attribute.
|
||||||
|
auto event = attribute(HTML::AttributeNames::event);
|
||||||
|
|
||||||
|
// 3. Strip leading and trailing ASCII whitespace from event and for.
|
||||||
|
for_ = for_.trim_whitespace();
|
||||||
|
event = event.trim_whitespace();
|
||||||
|
|
||||||
// 4. If for is not an ASCII case-insensitive match for the string "window", then return. The script is not executed.
|
// 4. If for is not an ASCII case-insensitive match for the string "window", then return. The script is not executed.
|
||||||
if (!for_.equals_ignoring_case("window")) {
|
if (!for_.equals_ignoring_case("window")) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue