Every line of 'elementbyid' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
4 export default function elementById(element, id) { 5 // conditionally return the matching element 6 if (element.attr && element.attr.id === id) { 7 return element; 8 } else if (element.children) { 9 // otherwise, return matching child elements 10 let index = -1; 11 let child; 12 13 while (child = element.children[++index]) { 14 child = elementById(child, id); 15 16 if (child) { 17 return child; 18 } 19 } 20 } 21 22 // return undefined if no matching elements are find 23 return undefined; 24 }
319 function getElementByID(id: string): any { 320 let debugElement = fixture.debugElement.query(By.css(`#${id}`)); 321 if (debugElement === null) { 322 return null; 323 } 324 return debugElement.nativeElement; 325 }
1 function elById(id) { 2 return document.getElementById(id); 3 }
15 getElement(id: string) { 16 return this.http.get(id, { headers: this.headers }).map((res: Response) => res.json()); 17 }
124 function elementWithId(id) { 125 var document = getActiveDocument(); 126 return document.getElementById(id) 127 }
57 async findById(id) { 58 return await this.findByLocator(By.id(id)); 59 }
113 public async getElementById(id: string): Promise < any > { 114 let el: any; 115 await asyncForEach(this.availableServices, async (s: any) => { 116 await asyncForEach(this.serviceMap[s.name].resources, async (r: Resource) => { 117 const element: any = r.getElement(id); 118 if (element && element.data) { 119 const data = (element.data as BehaviorSubject).getValue().data; 120 el = data; 121 } 122 }); 123 }); 124 return this.clone(el); 125 }
30 function element(id) 31 { 32 return document.getElementById(id); 33 }
18 function getByIdOrThrow(id: string) { 19 const el = document.getElementById(id); 20 21 if (el == null) { 22 throw new Error(`Could not find element: ${id}`); 23 } 24 25 return el; 26 }
59 function element(id) { 60 return elements[id] || (elements[id] = doc.getElementById(id)); 61 }