MCPcopy Create free account
hub / github.com/nodejs/node / get_script_url

Function get_script_url

test/fixtures/wpt/resources/testharness.js:4988–5010  ·  view source on GitHub ↗

Returns the 'src' URL of the first tag in the page to include the file 'testharness.js'.

()

Source from the content-addressed store, hash-verified

4986
4987 /** Returns the 'src' URL of the first <script> tag in the page to include the file 'testharness.js'. */
4988 function get_script_url()
4989 {
4990 if (!('document' in global_scope)) {
4991 return undefined;
4992 }
4993
4994 var scripts = document.getElementsByTagName("script");
4995 for (var i = 0; i < scripts.length; i++) {
4996 var src;
4997 if (scripts[i].src) {
4998 src = scripts[i].src;
4999 } else if (scripts[i].href) {
5000 //SVG case
5001 src = scripts[i].href.baseVal;
5002 }
5003
5004 var matches = src && src.match(/^(.*\/|)testharness\.js$/);
5005 if (matches) {
5006 return src;
5007 }
5008 }
5009 return undefined;
5010 }
5011
5012 /** Returns the <title> or filename or "Untitled" */
5013 function get_title()

Callers 1

get_stackFunction · 0.70

Calls 1

matchMethod · 0.65

Tested by

no test coverage detected