Created
September 12, 2011 19:52
-
-
Save sdesai/1212204 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_uiAddChild: function (child, parentNode) { | |
// Out of the box, this is never async, so things will always work, even if children are | |
// rendered out of order. | |
// The plugin modifies this code to be async (by moving the defRenderFn to an async queue). | |
// Since it's doing this, I think it's also appropriate for it to override any methods | |
// which were written based on the assumption that child.render() was always synchronous. | |
child.render(parentNode); | |
// If render() is made async, we can't rely on this being invoked with content in the DOM, so | |
var childBB = child.get("boundingBox"), | |
siblingBB, | |
nextSibling = child.next(false), | |
prevSibling; | |
if (nextSibling) { | |
siblingBB = nextSibling.get(BOUNDING_BOX); | |
siblingBB.insert(childBB, "before"); | |
} else { | |
prevSibling = child.previous(false); | |
if (prevSibling) { | |
siblingBB = prevSibling.get(BOUNDING_BOX); | |
siblingBB.insert(childBB, "after"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment