View Full Version : mutation event - IE equiv
DHTML Kitchen
05-05-2005, 07:26 PM
My script needs to receive notification when a node has been inserted/removed from a container.
I can use MutationEvent for browsers that support Events. What about IE?
I tried onpropertychange, but the onpropertychange did not fire for the node insertion.
brothercake
05-05-2005, 09:03 PM
Hmm .. I don't think so .. I seem to recall wanting something similar before, and not being able to find anything.
I assume you've though of the obvious tricks - watch the length of a node collection with setInterval or something like that?
DHTML Kitchen
05-05-2005, 10:51 PM
ewwww. Polling the DOM? That's just ugly, and not fail-safe, either (introduces poss. race cond).
I'm just gonna encourage the user to use my script's add feature to add more options to the list. (the script is notified by the add feature.)
enumerator
05-05-2005, 10:55 PM
How about just firing the event?
DHTML Kitchen
05-05-2005, 11:54 PM
fire what event?
enumerator
05-05-2005, 11:55 PM
onpropertychange
brothercake
05-06-2005, 12:31 AM
ewwww. Polling the DOM? That's just ugly, and not fail-safe, either (introduces poss. race cond).
I'm just gonna encourage the user to use my script's add feature to add more options to the list. (the script is notified by the add feature.)
It's safe enough ... as long as you check for ... well, everything you need to modify, and there are no synchronisation issues [which I guess there are, if that's not a workable idea]
What are you trying to do here - can you go back up the process and fire manual notifications from whatever causes the DOM to change in the first place?
It's safe enough ... as long as you check for ... well, everything you need to modify, and there are no synchronisation issues [which I guess there are, if that's not a workable idea]
What are you trying to do here - can you go back up the process and fire manual notifications from whatever causes the DOM to change in the first place?
that is what I was wondering, why not do something like:
function wrapper(arg1, arg2) {
original(arg1, arg2);
fire_notice();
}
edit: or maybe something that applies more to your code.. but you get my drift probably..
DHTML Kitchen
05-06-2005, 08:17 PM
Well, yah I can control every thing myself, but what if an implementation of the script. the implementor changes the doc frag that my script uses?
Well, the script will break!
I wanted to make it so the script would have a notification, then re-init upon receiving such notification.
Apparently, this is not possible.
I actually believed that IE would have some feature for this. I'm so naive! :)
So now I'm making a method so you can go and change the html through the script, making it easy to resolve the notification issue.
enumerator
05-06-2005, 08:22 PM
All events of that nature appear to be reserved for data binding (or tables)...
brothercake
05-08-2005, 04:21 PM
So now I'm making a method so you can go and change the html through the script, making it easy to resolve the notification issue.
Right, so your problem is if another script changes your structure; and you're compensating by providing monitorable-hooks for doing the same job.
So it's still possible for that to happen, but unlikely (and no longer your responsibility) because you've catered for the practical purpose of it elsewhere.
Makes sense :thumbsup:
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.