Summary: | 4.0.1: addEventListener check fails (regression from 3.5) | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Luke-Jr <luke-jr+kdebugs> |
Component: | kjs | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED NOT A BUG | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Luke-Jr
2008-02-08 00:01:16 UTC
You're relying on a mozilla standards non-compliance there. There was a bug in KJS 3.x that made it sort-of-compatible with it, but it's now been changed to follow the standard, like every other web browser out there. Function declarations are specified by ECMA-262-3 to be processed at function entry time, the conditionals don't matter at all. See sections 10.1.3 and 13. What you want to do is this: if (window.addEventListener) { var trapEvent = function trapEvent(o, t, func) { ... etc. Wouldn't that make 'trapEvent' scoped to just that 'if' statement? No. There are no local scopes in ECMAScript[1]. Anything defined with 'var' is scoped to the function. [1] Mozilla's JavaScript has non-standard extensions for those, of course. |