MCPcopy
hub / github.com/winjs/winjs / createSelect

Function createSelect

src/js/WinJS/ControlProcessor.js:29–58  ·  view source on GitHub ↗
(element)

Source from the content-addressed store, hash-verified

27 var processedAllCalled = false;
28
29 function createSelect(element) {
30 var result = function select(selector) {
31 /// <signature helpKeyword="WinJS.UI.select.createSelect">
32 /// <summary locid="WinJS.UI.select.createSelect">
33 /// Walks the DOM tree from the given element to the root of the document, whenever
34 /// a selector scope is encountered select performs a lookup within that scope for
35 /// the given selector string. The first matching element is returned.
36 /// </summary>
37 /// <param name="selector" type="String" locid="WinJS.UI.select.createSelect_p:selector">The selector string.</param>
38 /// <returns type="HTMLElement" domElement="true" locid="WinJS.UI.select.createSelect_returnValue">The target element, if found.</returns>
39 /// </signature>
40 var current = element;
41 var selected;
42 while (current) {
43 if (current.msParentSelectorScope) {
44 var scope = current.parentNode;
45 if (scope) {
46 selected = _ElementUtilities._matchesSelector(scope, selector) ? scope : scope.querySelector(selector);
47 if (selected) {
48 break;
49 }
50 }
51 }
52 current = current.parentNode;
53 }
54
55 return selected || _Global.document.querySelector(selector);
56 };
57 return markSupportedForProcessing(result);
58 }
59
60 function activate(element, Handler) {
61 return new Promise(function activate2(complete, error) {

Callers 2

activateFunction · 0.85
scopedSelectFunction · 0.85

Calls 1

Tested by

no test coverage detected