private JsArray <HtmlElement> findChildNodesForSelector(JsArray <HtmlElement> elements, JsArray <JsString> selectorArray) { var selector = selectorArray.shift(); //We need to actually abstract this so we can deal with IE and Opera returning a collection instead of a NodeList var newElements = new JsArray <HtmlElement>(); if (selector.substr(0, 1) == ".") { var className = selector.substring(1); //Lets assume this is a class selector while (elements.length > 0) { var element = elements.pop(); var nodes = element.getElementsByClassName(className); for (var j = 0; j < nodes.length; j++) { newElements.push(nodes[j].As <HtmlElement>()); } } } else { //invalid but going to assume type for now while (elements.length > 0) { var element = elements.pop(); var nodes = element.getElementsByTagName(selector); for (var j = 0; j < nodes.length; j++) { newElements.push(nodes[j].As <HtmlElement>()); } } } //Only recurse if there is another selector if (selectorArray.length > 0) { newElements = findChildNodesForSelector(newElements, selectorArray); } return(newElements); }
public void _moveBallInternal(ball b, JsArray<point> points, JsAction callback) { itemBase self = this; point point = points.pop(); if (point != null) { b.getDiv().style.left = point.x + "%"; b.getDiv().style.top = point.y + "%"; if (point.inSide != ESlide.none) { b.setInSide(point.inSide); } HtmlContext.window.setTimeout(delegate { self._moveBallInternal(b, points, callback); }, 50); } else { callback(); } }
public T Pop() { return(storage.pop().As <T>()); }
public void removeFromArray(JsArray items, JsObject obj) { JsArray tmpArray = new JsArray(); foreach (JsObject tmp in items) { if (tmp != obj) { tmpArray.push(tmp); } } while (items.length > 0) { items.pop(); } foreach (object tmp in tmpArray) { items.push(tmp); } }
private JsArray<HtmlElement> findChildNodesForSelector(JsArray<HtmlElement> elements, JsArray<JsString> selectorArray) { var selector = selectorArray.shift(); //We need to actually abstract this so we can deal with IE and Opera returning a collection instead of a NodeList var newElements = new JsArray<HtmlElement>(); if ( selector.substr( 0, 1 ) == "." ) { var className = selector.substring( 1 ); //Lets assume this is a class selector while ( elements.length > 0 ) { var element = elements.pop(); var nodes = element.getElementsByClassName( className ); for ( var j=0; j<nodes.length; j++) { newElements.push( nodes[ j ].As<HtmlElement>() ); } } } else { //invalid but going to assume type for now while (elements.length > 0) { var element = elements.pop(); var nodes = element.getElementsByTagName(selector); for (var j = 0; j < nodes.length; j++) { newElements.push( nodes[j].As<HtmlElement>() ); } } } //Only recurse if there is another selector if (selectorArray.length > 0) { newElements = findChildNodesForSelector(newElements, selectorArray); } return newElements; }