-
Notifications
You must be signed in to change notification settings - Fork 27.5k
jqLite should create elements in same way as jQuery #369
Comments
We will likely never do everything that jquery does to create elements, but the jQuery does a lot of magic to create elements and nodes because they have to. We are not interested in going into that business, so only the most common elements should be supported by us. |
We researched this and jquery does some crazy shit to get this to work. The main problem is that when you use innerHTML to create DOM elements from a string, browsers sometimes don't create these elements in the same way as if you created them via This affects the script tags as well and results in the scripts not executing when a dom chunk with script element is appended to the document. In order for us to get this to work, we'd have to parse and append html before any script tag, parse out the script tag, execute it, and parse and append any non-script html afterwards. If we wanted to support This is too much craziness for jqlite, so we are not going to do it. Instead we are going to document that if you want have script elements in ng:include or ng:view templates, you should use jquery. |
I agree on that - we don't want to do all the things jQuery does to get this working. But then, we have to revert $browser.xhr to use rawDocument.createElement('script') instead of jqLite to get JSONP working... |
Gist to reproduce issue: https://gist.github.com/1010228
First script - create script element using jqLite - load source for failed
Second script - create script element using raw
document.createElement()
- successWhen loading jQuery, it works fine (jgLite uses jQuery then)...
For More more info see: #344
On my Ubuntu machine the issue is seen only on FF4, works fine on Chrome, FF3.
Observing the issue:
The text was updated successfully, but these errors were encountered: