Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_applyContentEditable(
status,
target = this.shadowRoot.querySelector("#body")
) {
let children =
target.localName === "slot"
? wrap(target).assignedNodes({ flatten: true })
: [];
// fallback for content nodes if not polymer managed nodes above
if (children.length === 0) {
children = FlattenedNodesObserver.getFlattenedNodes(target);
}
for (var i = 0, len = children.length; i < len; i++) {
// we have to tell the browser that primatives are editable
if (this._HTMLPrimativeTest(children[i])) {
if (status) {
children[i].setAttribute("contenteditable", status);
children[i].setAttribute("data-editable", status);
if (children[i].querySelectorAll("a").length > 0) {
let links = children[i].querySelectorAll("a");
for (var j = 0, len2 = links.length; j < len2; j++) {
links[j].setAttribute("contenteditable", status);
links[j].setAttribute("data-editable", status);
links[j].addEventListener("click", e => {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
}
this.value[property] = this.activeHaxElement.properties[property];
}
}
var slotsApplied = false;
for (var prop in props.settings[newValue]) {
let previewNode = this.previewNode;
if (
typeof props.settings[this.formKey][prop].slot !==
typeof undefined &&
!slotsApplied
) {
slotsApplied = true;
// walk through the slots looking for the value of it
const previewNodeChildren = FlattenedNodesObserver.getFlattenedNodes(
previewNode
);
for (var i in previewNodeChildren) {
// test for element nodes to be safe
if (
typeof previewNodeChildren[i] !== typeof undefined &&
previewNodeChildren[i].nodeType === 1 &&
previewNodeChildren[i].slot ===
props.settings[this.formKey][prop].slot
) {
if (
typeof previewNodeChildren[i].innerHTML !== typeof undefined
) {
schema.properties[
props.settings[this.formKey][prop].slot
].value = previewNodeChildren[i].innerHTML;
it('should define button label using light DOM', () => {
const children = FlattenedNodesObserver.getFlattenedNodes(label);
expect(children[0].textContent).to.be.equal('Lit ');
expect(children[1].outerHTML).to.be.equal('<i>Button</i>');
});
it('should define checkbox label using light DOM', () => {
const children = FlattenedNodesObserver.getFlattenedNodes(label);
expect(children[0].textContent).to.be.equal('Lit ');
expect(children[1].outerHTML).to.be.equal('<i>Checkbox</i>');
});
_getCodeTemplate() {
const nodes = FlattenedNodesObserver.getFlattenedNodes(this.$.content);
return [].filter.call(nodes, (node) => node.nodeType === Node.ELEMENT_NODE)[0];
}
_getCodeTemplate() {
const nodes = FlattenedNodesObserver.getFlattenedNodes(this.$.content);
return [].filter.call(nodes, (node) => node.nodeType === Node.ELEMENT_NODE)[0];
}