diff --git a/client/fling/dist/runtime/apps/adminz/adminz.dart b/client/fling/dist/runtime/apps/adminz/adminz.dart index 8d7de5c71fb..0dea4b67b8b 100644 --- a/client/fling/dist/runtime/apps/adminz/adminz.dart +++ b/client/fling/dist/runtime/apps/adminz/adminz.dart @@ -125,7 +125,7 @@ class Adminz { static String _getPrefix(Window window) { Document document = window.document; String name = '/Adminz.app'; - NodeList items = document.query('script'); + NodeList items = document.queryAll('script'); for (int i = 0, n = items.length; i < n; ++i) { ScriptElement s = items[i]; String src = s.src; diff --git a/client/html/benchmarks/dromaeo/Dromaeo.dart b/client/html/benchmarks/dromaeo/Dromaeo.dart index 4ae1d9a54c1..2e1dd6870fc 100644 --- a/client/html/benchmarks/dromaeo/Dromaeo.dart +++ b/client/html/benchmarks/dromaeo/Dromaeo.dart @@ -65,7 +65,7 @@ class SuiteController { // to .innerHTML update above. _element = div.nodes.first; - document.queryOne('#main').nodes.add(div); + document.query('#main').nodes.add(div); } DivElement _createDiv(String clazz) { @@ -97,8 +97,8 @@ class Dromaeo { run() { // TODO(antonm): create Re-run tests href. - document.queryOne('#overview').elements.first.innerHTML = 'DOM Core Tests'; - _css(document.queryOne('#tests'), 'display', 'none'); + document.query('#overview').elements.first.innerHTML = 'DOM Core Tests'; + _css(document.query('#tests'), 'display', 'none'); for (SuiteDescription suite in Suites.SUITE_DESCRIPTIONS) { final iframe = document.createElement('iframe'); _css(iframe, 'height', '1px'); @@ -123,11 +123,11 @@ class Dromaeo { final mins = (estimatedTimeSecs / 60).floor().toInt(); final secs = (estimatedTimeSecs - mins * 60).round().toInt(); final secsAsString = (secs < 10 ? '0' : '') + secs; - document.queryOne('#left').innerHTML = '${mins}:${secsAsString}'; + document.query('#left').innerHTML = '${mins}:${secsAsString}'; final elapsed = totalTimeSecs - estimatedTimeSecs; final percent = (100 * elapsed / totalTimeSecs).toStringAsFixed(2); - _css(document.queryOne('#timebar'), 'width', '${percent}%'); + _css(document.query('#timebar'), 'width', '${percent}%'); } Function loading, running, done; diff --git a/client/html/benchmarks/dromaeo/tests/DomAttr.dart b/client/html/benchmarks/dromaeo/tests/DomAttr.dart index de2b9c5da98..a810a655716 100644 --- a/client/html/benchmarks/dromaeo/tests/DomAttr.dart +++ b/client/html/benchmarks/dromaeo/tests/DomAttr.dart @@ -5,8 +5,8 @@ class Main { // Try to force real results. var ret; window.on.load.add((Event evt) { - Element elem = document.queryOne('#test1'); - Element a = document.queryOne('a'); + Element elem = document.query('#test1'); + Element a = document.query('a'); new Suite('dom-attr') .test('getAttribute', void _() { diff --git a/client/html/benchmarks/dromaeo/tests/DomQuery.dart b/client/html/benchmarks/dromaeo/tests/DomQuery.dart index f98e5b06a17..67e7e412b1f 100644 --- a/client/html/benchmarks/dromaeo/tests/DomQuery.dart +++ b/client/html/benchmarks/dromaeo/tests/DomQuery.dart @@ -25,73 +25,73 @@ class Main { }) .test('getElementById', () { for (int i = 0; i < num * 30; i++) { - ret = document.queryOne('#testA' + num).tagName; - ret = document.queryOne('#testB' + num).tagName; - ret = document.queryOne('#testC' + num).tagName; - ret = document.queryOne('#testD' + num).tagName; - ret = document.queryOne('#testE' + num).tagName; - ret = document.queryOne('#testF' + num).tagName; + ret = document.query('#testA' + num).tagName; + ret = document.query('#testB' + num).tagName; + ret = document.query('#testC' + num).tagName; + ret = document.query('#testD' + num).tagName; + ret = document.query('#testE' + num).tagName; + ret = document.query('#testF' + num).tagName; } }) .test('getElementById (not in document)', () { for (int i = 0; i < num * 30; i++) { - ret = document.queryOne('#testA'); - ret = document.queryOne('#testB'); - ret = document.queryOne('#testC'); - ret = document.queryOne('#testD'); - ret = document.queryOne('#testE'); - ret = document.queryOne('#testF'); + ret = document.query('#testA'); + ret = document.query('#testB'); + ret = document.query('#testC'); + ret = document.query('#testD'); + ret = document.query('#testE'); + ret = document.query('#testF'); } }) .test('getElementsByTagName(div)', () { for (int i = 0; i < num; i++) { - var elems = document.query('div'); + var elems = document.queryAll('div'); ret = elems[elems.length-1].nodeType; } }) .test('getElementsByTagName(p)', () { for (int i = 0; i < num; i++) { - final elems = document.query('p'); + final elems = document.queryAll('p'); ret = elems[elems.length-1].nodeType; } }) .test('getElementsByTagName(a)', () { for (int i = 0; i < num; i++) { - var elems = document.query('a'); + var elems = document.queryAll('a'); ret = elems[elems.length-1].nodeType; } }) .test('getElementsByTagName(*)', () { for (int i = 0; i < num; i++) { - var elems = document.query('*'); + var elems = document.queryAll('*'); ret = elems[elems.length-1].nodeType; } }) .test('getElementsByTagName (not in document)', () { for (int i = 0; i < num; i++) { - var elems = document.query('strong'); + var elems = document.queryAll('strong'); ret = elems.length == 0; } }) .test('getElementsByName', () { for (int i = 0; i < num * 20; i++) { - var elems = document.query('[name=test$num]'); + var elems = document.queryAll('[name=test$num]'); ret = elems[elems.length-1].nodeType; - elems = document.query('[name=test$num]'); + elems = document.queryAll('[name=test$num]'); ret = elems[elems.length-1].nodeType; - elems = document.query('[name=test$num]'); + elems = document.queryAll('[name=test$num]'); ret = elems[elems.length-1].nodeType; - elems = document.query('[name=test$num]'); + elems = document.queryAll('[name=test$num]'); ret = elems[elems.length-1].nodeType; } }) .test('getElementsByName (not in document)', () { for (int i = 0; i < num * 20; i++) { - ret = document.query('[name=test]').length == 0; - ret = document.query('[name=test]').length == 0; - ret = document.query('[name=test]').length == 0; - ret = document.query('[name=test]').length == 0; - ret = document.query('[name=test]').length == 0; + ret = document.queryAll('[name=test]').length == 0; + ret = document.queryAll('[name=test]').length == 0; + ret = document.queryAll('[name=test]').length == 0; + ret = document.queryAll('[name=test]').length == 0; + ret = document.queryAll('[name=test]').length == 0; } }) .end(); diff --git a/client/html/src/Document.dart b/client/html/src/Document.dart index 0921494fbbd..f6cf9bf8893 100644 --- a/client/html/src/Document.dart +++ b/client/html/src/Document.dart @@ -50,7 +50,7 @@ interface Document extends Element /*, common.NodeSelector */ { StyleSheetList get styleSheets(); - // TODO(jacobr): should this be removed? Users could write document.queryOne("title").text instead. + // TODO(jacobr): should this be removed? Users could write document.query("title").text instead. String get title(); void set title(String value); diff --git a/client/html/src/DocumentFragment.dart b/client/html/src/DocumentFragment.dart index 0335ae5ec5c..683af4ceddb 100644 --- a/client/html/src/DocumentFragment.dart +++ b/client/html/src/DocumentFragment.dart @@ -6,7 +6,7 @@ interface DocumentFragment extends Node factory DocumentFragmentWrappingImplemen DocumentFragment(); - Element queryOne(String selectors); + Element query(String selectors); - ElementList query(String selectors); + ElementList queryAll(String selectors); } diff --git a/client/html/src/DocumentFragmentWrappingImplementation.dart b/client/html/src/DocumentFragmentWrappingImplementation.dart index 4bdb61708a6..aa1e4c5372b 100644 --- a/client/html/src/DocumentFragmentWrappingImplementation.dart +++ b/client/html/src/DocumentFragmentWrappingImplementation.dart @@ -10,11 +10,11 @@ class DocumentFragmentWrappingImplementation extends NodeWrappingImplementation _rawDocument.createDocumentFragment()); } - Element queryOne(String selectors) { + Element query(String selectors) { return LevelDom.wrapElement(_ptr.querySelector(selectors)); } - ElementList query(String selectors) { + ElementList queryAll(String selectors) { return LevelDom.wrapElementList(_ptr.querySelectorAll(selectors)); } } diff --git a/client/html/src/Element.dart b/client/html/src/Element.dart index 9e44c45301b..b375e14fd1f 100644 --- a/client/html/src/Element.dart +++ b/client/html/src/Element.dart @@ -188,9 +188,9 @@ interface Element extends Node /*, common.NodeSelector, common.ElementTraversal void insertAdjacentText([String where, String text]); - Element queryOne(String selectors); + Element query(String selectors); - ElementList query(String selectors); + ElementList queryAll(String selectors); void scrollByLines([int lines]); diff --git a/client/html/src/ElementWrappingImplementation.dart b/client/html/src/ElementWrappingImplementation.dart index d7aec67b6b0..a9876fe5afe 100644 --- a/client/html/src/ElementWrappingImplementation.dart +++ b/client/html/src/ElementWrappingImplementation.dart @@ -544,12 +544,12 @@ class ElementWrappingImplementation extends NodeWrappingImplementation implement _ptr.insertAdjacentText(where, text); } - Element queryOne(String selectors) { + Element query(String selectors) { // TODO(jacobr): scope fix. return LevelDom.wrapElement(_ptr.querySelector(selectors)); } - ElementList query(String selectors) { + ElementList queryAll(String selectors) { // TODO(jacobr): scope fix. return new FrozenElementList._wrap(_ptr.querySelectorAll(selectors)); } diff --git a/client/tests/client/layout/GridLayoutDemo.dart b/client/tests/client/layout/GridLayoutDemo.dart index 90b4c49bc66..754532a7ac6 100644 --- a/client/tests/client/layout/GridLayoutDemo.dart +++ b/client/tests/client/layout/GridLayoutDemo.dart @@ -60,7 +60,7 @@ void addGridStyles(String width, String height, [String margin = '']) { } void _addColorStyles() { - final grid = document.body.queryOne('#grid'); + final grid = document.body.query('#grid'); final colors = const [ 'darkred', 'darkorange', 'darkgoldenrod', 'darkgreen', 'darkblue', 'darkviolet']; int c = 0; @@ -125,7 +125,7 @@ class MockView extends View { void printMetrics(String example) { - final node = document.body.queryOne('#grid'); + final node = document.body.query('#grid'); String exampleId = example.split(' ')[0]; final sb = new StringBuffer(); sb.add('void testSpecExample${exampleId}() {\n'); diff --git a/client/tests/client/layout/GridLayoutTests.dart b/client/tests/client/layout/GridLayoutTests.dart index 041fc4ba8d4..1358061adc7 100644 --- a/client/tests/client/layout/GridLayoutTests.dart +++ b/client/tests/client/layout/GridLayoutTests.dart @@ -66,7 +66,7 @@ class GridLayoutTests extends UnitTestSuite { for (String name in expected.getKeys()) { final values = expected[name]; - final node = document.body.queryOne('#$name'); + final node = document.body.query('#$name'); Expect.isNotNull(node); Expect.equals(values[0], node.offsetLeft); Expect.equals(values[1], node.offsetTop); diff --git a/client/tests/client/samples/dartcombat/dartcombat_tests.dart b/client/tests/client/samples/dartcombat/dartcombat_tests.dart index 0d77f7c735f..c8316e50434 100644 --- a/client/tests/client/samples/dartcombat/dartcombat_tests.dart +++ b/client/tests/client/samples/dartcombat/dartcombat_tests.dart @@ -51,7 +51,7 @@ class DartCombatTests extends UnitTestSuite { void testParallelShoot() { // player 2 is configured to make parallel super shots towards player 1 - var p1OwnBoard = document.queryOne("#p1own"); + var p1OwnBoard = document.query("#p1own"); // add a boat of length 4 using mousedown/mousemove/mouseup var startCell = p1OwnBoard.nodes[0].nodes[4].nodes[2]; @@ -78,14 +78,14 @@ class DartCombatTests extends UnitTestSuite { _expectShotSequence(expectedShots, p1OwnBoard, 1); // hit the boat from the enemy side. - var p2EnemyBoard = document.queryOne("#p2enemy"); + var p2EnemyBoard = document.query("#p2enemy"); var hitCell = p2EnemyBoard.nodes[0].nodes[4].nodes[3]; doMouseEvent("click", hitCell); } void testSerialShoot() { // player 1 is configured to make serial super shots towards player 2 - var p2OwnBoard = document.queryOne("#p2own"); + var p2OwnBoard = document.query("#p2own"); // add a boat of length 4 using mousedown/mousemove/mouseup var startCell = p2OwnBoard.nodes[0].nodes[3].nodes[8]; @@ -113,7 +113,7 @@ class DartCombatTests extends UnitTestSuite { _expectShotSequence(expectedShots, p2OwnBoard, 2); // hit the boat from the enemy side. - var p1EnemyBoard = document.queryOne("#p1enemy"); + var p1EnemyBoard = document.query("#p1enemy"); var hitCell = p1EnemyBoard.nodes[0].nodes[4].nodes[8]; doMouseEvent("click", hitCell); } diff --git a/client/tests/client/samples/swarm/swarm_tests.dart b/client/tests/client/samples/swarm/swarm_tests.dart index 2a460a0e908..97f330e02b6 100644 --- a/client/tests/client/samples/swarm/swarm_tests.dart +++ b/client/tests/client/samples/swarm/swarm_tests.dart @@ -105,12 +105,12 @@ class SwarmTests extends UnitTestSuite { Expect.equals(getView(swarm.sections[0]), swarm.frontView.currentSection); // Find the first slider menu item, and click on the one next after it. - _click(document.query('.${CSS.SM_ITEM}')[1]); + _click(document.queryAll('.${CSS.SM_ITEM}')[1]); Expect.equals(getView(swarm.sections[1]), swarm.frontView.currentSection); // Find the first menu item again and click on it. - _click(document.queryOne('.${CSS.SM_ITEM}')); + _click(document.query('.${CSS.SM_ITEM}')); Expect.equals(getView(swarm.sections[0]), swarm.frontView.currentSection); } diff --git a/client/touch/EventUtil.dart b/client/touch/EventUtil.dart index 7c44458d18b..0ff7c0c419a 100644 --- a/client/touch/EventUtil.dart +++ b/client/touch/EventUtil.dart @@ -38,7 +38,7 @@ class EventUtil { * nothing. For most browsers this will cause the keyboard to be dismissed. */ static void blurFocusedElement() { - Element focusedEl = document.queryOne("*:focus"); + Element focusedEl = document.query("*:focus"); if (focusedEl != null) { focusedEl.blur(); } diff --git a/client/view/PagedViews.dart b/client/view/PagedViews.dart index 91428344232..1a0c7c42fea 100644 --- a/client/view/PagedViews.dart +++ b/client/view/PagedViews.dart @@ -44,9 +44,9 @@ class PageNumberView extends View {