4

Is there currently a way to subscribe to an event of a wrapped set, that will trigger when any element is appended to it as a child element?

Maxim V. Pavlov
  • 10,303
  • 17
  • 74
  • 174

1 Answers1

1

There's nothing standard (DOM or jQuery) that's broadly supported. There were mutatation events specified in the DOM2 Events spec, but they were onerous to implement, never widely implemented, and deprecated in the DOM3 Events spec.

You might be able to hack the internal domManip function within jQuery, which is used for most of these sorts of operations; but of course that means every release of jQuery, you have to re-hack and the internals could change such that your hack doesn't work anymore (and would only work if the caller used jQuery do to the append; even in code written for jQuery I've been known to go direct to the DOM when it was convenient). There's a script in the answer accepted on the question AndreasAL found, but with the mutation events having been deprecated, well, your mileage may vary as browsers continue to update...

Community
  • 1
  • 1
T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875