html-demo-element
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -61,3 +61,2 @@ import "https://unpkg.com/prismjs@1.23.0/components/prism-core.min.js"; | ||
connectedCallback() | ||
@@ -73,8 +72,6 @@ { | ||
slot.setAttribute('slot',name); | ||
if( template ) | ||
{ const ref = template.nextElementSibling || template.parentElement.lastElementChild; | ||
template.parentElement.insertBefore( slot, ref ); | ||
}else | ||
this.insertBefore( slot, this.firstChild ); | ||
return slot; | ||
if( 'legend' === name ) | ||
return this.insertBefore( slot, this.firstChild ); | ||
return template ? template.parentElement.insertBefore( slot, template ) | ||
: this.append( slot ); | ||
}; | ||
@@ -87,8 +84,9 @@ | ||
template || demoDom.map( el => el.remove() ); | ||
this.demoSlot = createSlot('demo'); | ||
this.textSlot = createSlot('text'); | ||
this.textSlot = createSlot('text' ); | ||
this.demoSlot = createSlot('demo' ); | ||
this.legendSlot = createSlot('legend'); | ||
if( template ) | ||
this.demoSlot.append( template.content.cloneNode(true) ); | ||
else | ||
{ this.demoSlot.innerHTML = ''; | ||
this.demoSlot.append( template.content.cloneNode( true ) ); | ||
}else | ||
demoDom.map( el=> this.demoSlot.append(el)); | ||
@@ -99,3 +97,3 @@ this.render(); | ||
render() | ||
{ if( this.legend ) | ||
{ if( this.legendSlot && this.legend ) | ||
this.legendSlot.innerHTML = `<h3>${this.legend}</h3>`; | ||
@@ -102,0 +100,0 @@ |
{ | ||
"name": "html-demo-element", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Webcomponent inserts prism JS syntax colored HTML in html-demo-element before actual dom", | ||
@@ -22,2 +22,3 @@ "author": "Sasha Firsov", | ||
"scripts": { | ||
"start": "node demo/dev-server.cjs" | ||
}, | ||
@@ -24,0 +25,0 @@ "dependencies": { |
@@ -54,4 +54,4 @@ # html-demo-element | ||
# Live demo | ||
* https://unpkg.com/html-demo-element@1.0.3/demo/index.html | ||
* https://unpkg.com/html-demo-element@1.0.3/demo/advanced.html | ||
* https://unpkg.com/html-demo-element@1.0.4/demo/index.html | ||
* https://unpkg.com/html-demo-element@1.0.4/demo/advanced.html | ||
* https://unpkg.com/slotted-element@1.0.2/demo/index.html | ||
@@ -72,4 +72,4 @@ | ||
* `source` - the source code text. If the attribute is not defined, it would be initialized from `source` slot ^^ | ||
* `type` - one of (prism js supported languages)[https://prismjs.com/#supported-languages]. | ||
* `type` - one of [prism js supported languages](https://prismjs.com/#supported-languages). | ||
`html`, `css`, `js` imported by default. When omitted, assumed `html`. | ||
* `legend` - optional heading for `html-demo-element` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
116861
9
134
1
7