Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for u.ie9.js #1

Merged
merged 2 commits into from
Jun 2, 2015
Merged

Fixes for u.ie9.js #1

merged 2 commits into from
Jun 2, 2015

Conversation

detomon
Copy link
Contributor

@detomon detomon commented Jun 1, 2015

When using u.ie9.js, document.body was undefined at the time the script was executing, because the DOM was not fully loaded. My first attempt was to wrap the definition of the override methods inside a DOMContentLoaded event listener, so the body would be available. But, it needed to execute before all other user defined init handlers (registered with u(func)). So I defined an ordered list of init handlers in u.js. Instead of binding them directly to DOMContentLoaded, the handlers are now added to the list and executed within a single DOMContentLoaded listener. This gives u.ie9.js the change to add its handler at the beginning of the list.
Additionally, the index arguments of the iterator callbacks were missing.

This solves a problem evolved from `u.ie9.js`: `document.body` was not defined
when the script was executed. But it is available after `DOMContentLoaded`.
However, the user may add init handler with u(func) at any time. But the
specialized class function have to be overridden *before* any handler is called.
The ordered initializer list solves this problem.
@iamso
Copy link
Owner

iamso commented Jun 2, 2015

Good catch. Thanks.
I will, however, modify it a little to fit the minimalistic nature of u.js.

iamso added a commit that referenced this pull request Jun 2, 2015
@iamso iamso merged commit 8e2614c into iamso:master Jun 2, 2015
@detomon detomon deleted the fix-ie9 branch September 11, 2016 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants