forked from jeresig/env-js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix for ticket #119, and general script tag processing
- Loading branch information
Showing
3 changed files
with
81 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 comments
on commit d07dbde
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love that you are looking at my commits!
Yeah my comment-in-code is not correct either. The use case I had was
var s = document.createElement('script');
s.text = 'alert("foo");
// --does not fire--
document.addChild (or appendNode or whatever it is)(s);
// Alert!
I like tracking this in code... I will add your notes right in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check out
http://github.com/thatcher/env-js/commit/701dd59f63f8b3a0f7fb6f34a43342add6b04577
and see if that captures the issues. thankee.
Hmmm ... my first github comment ... I've seen jquery using it a lot ...
I think the part about not executing the script is wrong. The spec says
When a script element that is neither marked as having "already started" nor marked as being "parser-inserted" experiences one of the events listed in the following list, the user agent must synchronously run the script element:
The script element gets inserted into a document.
The script element is in a Document and its child nodes are changed.
The script element is in a Document and has a src attribute set where previously the element had no such attribute.
So in some cases we do need to run it, but we need to implement the rest of the state machine described in the spec so we don't run it in cases where we shouldn't.