Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function shouldApplyFix(document: Document, svgNamespace: SVG_NAMESPACE) {
let svg = document.createElementNS(svgNamespace, 'svg');
try {
svg['insertAdjacentHTML']('beforeend', '');
} catch (e) {
// IE, Edge: Will throw, insertAdjacentHTML is unsupported on SVG
// Safari: Will throw, insertAdjacentHTML is not present on SVG
} finally {
// FF: Old versions will create a node in the wrong namespace
if (svg.childNodes.length === 1 && unwrap(svg.firstChild).namespaceURI === SVG_NAMESPACE) {
// The test worked as expected, no fix required
return false;
}
return true;
}
}
this.assert.equal(selectNode.selectedIndex, 0);
this.assertStableNodes();
this.rerender({ selected: '' });
this.assertHTML(strip`
<select>
<option>1</option>
<option selected="true'">2</option>
<option>3</option>
</select>
`);
selectNode = unwrap(firstElementChild(this.element)) as HTMLSelectElement;
this.assert.equal(selectNode.selectedIndex, 0);
this.assertStableNodes();
this.rerender({ selected: true });
this.assertHTML(strip`
<select>
<option>1</option>
<option selected="true'">2</option>
<option>3</option>
</select>
`);
selectNode = unwrap(firstElementChild(this.element)) as HTMLSelectElement;
this.assert.equal(selectNode.selectedIndex, 1);
builder.startLabels();
builder.pushFrame();
builder.returnTo('END');
expr(params[0], builder);
builder.toBoolean();
builder.enter(1);
builder.jumpUnless('ELSE');
builder.invokeStaticBlock(unwrap(template));
if (inverse) {
builder.jump('EXIT');
builder.label('ELSE');
builder.invokeStaticBlock(inverse);
builder.label('EXIT');
builder.exit();
builder.return();
} else {
builder.label('ELSE');
builder.exit();
builder.return();
}
builder.jumpUnless('ELSE');
builder.pushFrame();
builder.returnTo('ITER');
builder.dup(Register.fp, 1);
builder.enterList('BODY');
builder.label('ITER');
builder.iterate('BREAK');
builder.label('BODY');
builder.invokeStatic(unwrap(template), 2);
builder.pop(2);
builder.exit();
builder.return();
builder.label('BREAK');
builder.exitList();
builder.popFrame();
if (inverse) {
builder.jump('EXIT');
builder.label('ELSE');
builder.invokeStatic(inverse);
builder.label('EXIT');
builder.exit();
builder.putIterator();
builder.jumpUnless('ELSE');
builder.pushFrame();
builder.dup(Register.fp, 1);
builder.returnTo('ITER');
builder.enterList('BODY');
builder.label('ITER');
builder.iterate('BREAK');
builder.label('BODY');
builder.invokeStaticBlock(unwrap(template), 2);
builder.pop(2);
builder.jump('FINALLY');
builder.label('BREAK');
builder.exitList();
builder.popFrame();
builder.jump('FINALLY');
builder.label('ELSE');
if (inverse) {
builder.invokeStaticBlock(inverse);
}
},
});
invoke(vm: VM, _partial: Option) {
let partial = unwrap(_partial);
let partialSymbols = partial.symbolTable.symbols;
let outerScope = vm.scope();
let partialScope = vm.pushRootScope(partialSymbols.length, false);
partialScope.bindCallerScope(outerScope.getCallerScope());
partialScope.bindEvalScope(outerScope.getEvalScope());
partialScope.bindSelf(outerScope.getSelf());
let { evalInfo, outerSymbols } = this;
let locals = dict>();
evalInfo.forEach(slot => {
let name = outerSymbols[slot - 1];
let ref = outerScope.getSymbol(slot);
locals[name] = ref;
});
ifTrue() {
return invokeStaticBlockWithStack(unwrap(blocks.get('default')), 1);
},
ifTrue() {
return invokeStaticBlock(unwrap(blocks.get('default')));
},