<script> in $.html() $.load() what is the spec?
jQuery does not seem to document how it behaves when using $.html() or $.load() to insert an HTML document fragment into the current DOM:
What does it do with < script >
tags?
They are executed, though. But are nowhere to be found in the DOM. It seems jQuery inserts the开发者_如何学C script blocks just for a moment into the DOM or evals it.
There is no documentation this regard. Do you know any way to tune it, i.e. disable it? This has implications of security in nature!
The <script>
tags are stripped out of the code and explicitly executed after the DOM has been updated.
If you use "$.load()" with a URL that's got a selector in it (it's a hack-y feature of the API), like this:
$.load("http://something #stuff", ... )
then it will not run the scripts.
精彩评论