pull/6449/head
Conduitry 5 years ago
parent ef025d9542
commit a43fb64a1e

@ -37,11 +37,11 @@ function init_hydrate(target: NodeEx) {
type NodeEx2 = NodeEx & {claim_order: number}; type NodeEx2 = NodeEx & {claim_order: number};
// We know that all children have claim_order values since the unclaimed have been detached if target is not head // We know that all children have claim_order values since the unclaimed have been detached if target is not <head>
let children: ArrayLike<NodeEx2> = target.childNodes as NodeListOf<NodeEx2>; let children: ArrayLike<NodeEx2> = target.childNodes as NodeListOf<NodeEx2>;
// If target is head, there may be children without claim_order // If target is <head>, there may be children without claim_order
if (target.nodeName.toLowerCase() === 'head') { if (target.nodeName === 'HEAD') {
const myChildren = []; const myChildren = [];
for (let i = 0; i < children.length; i++) { for (let i = 0; i < children.length; i++) {
const node = children[i]; const node = children[i];

@ -40,16 +40,14 @@ export function safe_not_equal(a, b) {
return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
} }
const relative_to_absolute : ((url: string) => string) & {anchor?: HTMLAnchorElement} = (url: string) => { let src_url_equal_anchor;
if (relative_to_absolute.anchor === undefined) {
relative_to_absolute.anchor = document.createElement('a');
}
relative_to_absolute.anchor.href = url;
return relative_to_absolute.anchor.href;
};
export function src_url_equal(element_src, url) { export function src_url_equal(element_src, url) {
return element_src === relative_to_absolute(url); if (!src_url_equal_anchor) {
src_url_equal_anchor = document.createElement('a');
}
src_url_equal_anchor.href = url;
return element_src === src_url_equal_anchor.href;
} }
export function not_equal(a, b) { export function not_equal(a, b) {

Loading…
Cancel
Save