Issue 13363 - Step 1.2 of compiling event handler

When compiling event handlers, check whether scripting is enabled
and early return None/null if not.

https://html.spec.whatwg.org/multipage/
webappapis.html#getting-the-current-value-of-the-event-handler

Issue 13363 - Fix spec for disabled scripting

The original spec for this PR was bad because it depended on the
DOM without scripting enabled to use Javascript to signal the test's
failure, so it could never fail.

Use an onerror handler on `window` where scripting is enabled, and
use an invalid string of JavaScript for the handler, to detect
whether or not the event handler is *really* being compiled or not.

Condense tests into a single HTML file

Yup, didn't even realize I could do that at the time.

Remove an unnecessary test
This commit is contained in:
Jesse Kipp 2016-10-16 00:18:41 -04:00
parent 759185abe0
commit 4f0ffbd1f6
3 changed files with 31 additions and 1 deletions

View file

@ -373,7 +373,10 @@ impl EventTarget {
None => self.downcast::<Window>().unwrap().Document(),
};
// TODO step 1.2 (browsing context/scripting enabled)
// Step 1.2
if !document.is_scripting_enabled() {
return None;
}
// Step 1.3
let body: Vec<u16> = handler.source.encode_utf16().collect();