MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / resolve

Function resolve

Ports/JavaScriptPort/src/main/webapp/js/fontmetrics.js:1526–1541  ·  view source on GitHub ↗
(url, base_url, doc)

Source from the content-addressed store, hash-verified

1524 var doc = parser.parseFromString(pageContent, "text/html");
1525
1526 function resolve(url, base_url, doc) {
1527 var old_base = doc.getElementsByTagName('base')[0]
1528 , old_href = old_base && old_base.href
1529 , doc_head = doc.head || doc.getElementsByTagName('head')[0]
1530 , our_base = old_base || doc_head.appendChild(doc.createElement('base'))
1531 , resolver = doc.createElement('a')
1532 , resolved_url
1533 ;
1534 our_base.href = base_url || '';
1535 resolver.href = url;
1536 resolved_url = resolver.href; // browser magic at work here
1537
1538 if (old_base) old_base.href = old_href;
1539 else doc_head.removeChild(our_base);
1540 return resolved_url;
1541 }
1542
1543 $('[href]', doc).each(function() {
1544 var absUrl = resolve($(this).attr('href'), url, doc);

Callers 12

fontmetrics.jsFile · 0.70
whenReadyFunction · 0.70
promptAsyncFunction · 0.70
RecordRTCPromisesHandlerFunction · 0.50
shimPeerConnectionFunction · 0.50
adapter.jsFile · 0.50
cn1InvokeNativeInterfaceFunction · 0.50
browser_bridge.jsFile · 0.50
finishFunction · 0.50
tickFunction · 0.50
tryLoadFunction · 0.50
settleFunction · 0.50

Calls 3

appendChildMethod · 0.65
createElementMethod · 0.65
removeChildMethod · 0.65

Tested by

no test coverage detected