jquery - Force re-eval inline and included Javascript -
I am injected the Java page into w / Greasemonkey, processing some of the body content (by adding markup) The problem of putting content is that all the events in the original content are destroyed, such things like onClick events are broken, which were initially added to the page loaded.
My original idea was to do this (using jQuery) (script) {$ (script) .appendTo ('head');})
code>Or simply:
$ ('script'). Annex ('head');
I thought this script would be due to the reload / revolve, but it does not work.
I would say a simple example of doing this: I have to re-apply this event in the application. Js
$ ("H2.section_heading"). Click (function () {// something}}
The question is What and when browsers are being added to the page in different ways In any case, as Poni says, there is no guarantee that running script of the page will have to work with new material for the second time. They may have all kinds of references to old (now replaced) nodes and can not expect that they should enter the second time also. Do not Resource on Markup. HTML string hacking is completely unreliable, when you type it back with You've got a very good dome tree sitting in the browser. Process it on, by adding elements and setting attributes to existing nodes! It's easy, way more reliable, and very fast for many tasks. & lt; Script & gt; If the tag is executed, then it is a thorny, if anything more is complex, with jQuery's efforts to work around this issue, you really do not want to include it.
innerHTML
then all old objects are different from the problem of place if you are saying, Via regex hacks on the HTML '& lt; Span class = "highlight" & gt; By adding
, you have a good dig at bugs, inconsistencies, and potential XSS vulnerabilities.
Comments
Post a Comment