Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
dashboard.panter.ch
Commits
14330bb5
Commit
14330bb5
authored
Dec 04, 2017
by
Andi Staub
Browse files
Scope changing of css classes only to the ones existing in the style tag
parent
2cab29d1
Pipeline
#10773
passed with stage
in 21 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/webcomponents/stateless-web-component.js
View file @
14330bb5
...
...
@@ -13,6 +13,7 @@ export default class StatelessWebComponent extends HTMLElement {
render
()
{
const
cssClassPrefix
=
this
.
constructor
.
name
;
const
element
=
document
.
createElement
(
'
div
'
);
element
.
innerHTML
=
this
.
template
();
...
...
@@ -28,7 +29,7 @@ export default class StatelessWebComponent extends HTMLElement {
styleTag
.
textContent
=
css
;
Array
.
from
(
element
.
querySelectorAll
(
'
[class]
'
)).
forEach
((
node
)
=>
{
Array
.
from
(
element
.
querySelectorAll
(
cssSelectors
.
join
(
'
,
'
)
)).
forEach
((
node
)
=>
{
const
classNames
=
Array
.
from
(
node
.
classList
);
classNames
.
forEach
((
className
)
=>
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment