Permalink
Browse files

Only call init() indirectly, and make those handlers which were calli…

…ng it call update() instead. It has the same effect since init() is called from update() anyway, and this prevents double-execution of update() if it happens to be called first (thanks to Paul Irish for pointing that out).
  • Loading branch information...
1 parent 5290f3a commit 40f2331174fdc7dccdc9365a04218f9d9149b9a9 Jason Johnston committed Jul 26, 2010
Showing with 3 additions and 5 deletions.
  1. +1 −3 sources/event_handlers.js
  2. +2 −2 sources/htc_open.txt
View
4 sources/event_handlers.js
@@ -177,12 +177,10 @@ function init() {
// Add property change listeners to ancestors if requested
initAncestorPropChangeListeners();
-
- update();
}
}
if( element.readyState === 'complete' ) {
- init();
+ update();
}
View
4 sources/htc_open.txt
@@ -11,8 +11,8 @@ Dual-licensed for use under the Apache License Version 2.0 or the General Public
<PUBLIC:ATTACH EVENT="onpropertychange" FOR="element" ONEVENT="propChanged()" />
<PUBLIC:ATTACH EVENT="onmouseenter" FOR="element" ONEVENT="mouseEntered()" />
<PUBLIC:ATTACH EVENT="onmouseleave" FOR="element" ONEVENT="mouseLeft()" />
- <PUBLIC:ATTACH EVENT="oncontentready" FOR="element" ONEVENT="init()" />
- <PUBLIC:ATTACH EVENT="ondocumentready" FOR="element" ONEVENT="init()" />
+ <PUBLIC:ATTACH EVENT="oncontentready" FOR="element" ONEVENT="update()" />
+ <PUBLIC:ATTACH EVENT="ondocumentready" FOR="element" ONEVENT="update()" />
<PUBLIC:ATTACH EVENT="ondetach" FOR="element" ONEVENT="cleanup()" />
<script type="text/javascript">

0 comments on commit 40f2331

Please sign in to comment.