-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest
More file actions
32 lines (25 loc) · 798 Bytes
/
test
File metadata and controls
32 lines (25 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(function () {
const elements = [].slice.call(document.querySelectorAll('[data-style-edit]'));
/**
* Get style declarations for current DOM Node
*
* @param {DOMNode} element Dom Node from which we retrive
* @return {Array} Array of CSS declarations
*/
const getStyleDeclarations = (element) => {
return element.dataset.styleEdit
}
const getDocumentStylesheets = () => {
console.log(document.styleSheets[0].cssRules)
return document.styleSheets
}
const searchElementDeclarations = (element) => {
let styles = [];
let obj = document.defaultView.getComputedStyle(element, null)
return obj
}
for(let i = 0; i < elements.length; ++i) {
getStyleDeclarations(elements[i])
console.log(searchElementDeclarations(elements[i]))
}
})();