Comparing version 0.1.21 to 0.1.22
@@ -33,5 +33,3 @@ 'use strict'; | ||
toString() { | ||
let {ownerElement, name, _value} = this; | ||
if (name === 'style' && ownerElement) | ||
_value = ownerElement.style.cssText; | ||
let {name, _value} = this; | ||
return _value ? `${name}="${escape(_value)}"` : name; | ||
@@ -38,0 +36,0 @@ } |
@@ -43,3 +43,3 @@ 'use strict'; | ||
else { | ||
const attr = updateKeys(style); | ||
let attr = updateKeys(style); | ||
if (value == null) | ||
@@ -49,8 +49,10 @@ style.delete(uhyphen(name)); | ||
style.set(uhyphen(name), value); | ||
if (attr) { | ||
attr._value = style.toString(); | ||
attr._changed = false; | ||
if (!attr) { | ||
const element = refs.get(style); | ||
attr = element.ownerDocument.createAttribute('style'); | ||
element.setAttributeNode(attr); | ||
style.set(DOM, attr); | ||
} | ||
else | ||
style.cssText = style.toString(); | ||
attr._value = style.toString(); | ||
attr._changed = false; | ||
} | ||
@@ -82,3 +84,4 @@ return true; | ||
toString() { | ||
get[DOM]() { | ||
updateKeys(this); | ||
const cssText = []; | ||
@@ -91,2 +94,4 @@ this.forEach((value, key) => { | ||
} | ||
toString() { return this[DOM]; } | ||
} | ||
@@ -93,0 +98,0 @@ exports.CSSStyleDeclaration = CSSStyleDeclaration |
@@ -318,9 +318,3 @@ 'use strict'; | ||
case ATTRIBUTE_NODE: | ||
if (_next.name === 'style') { | ||
const value = _next.toString(); | ||
if (value !== 'style') | ||
out.push(' ' + value); | ||
} | ||
else | ||
out.push(' ' + _next); | ||
out.push(' ' + _next); | ||
break; | ||
@@ -327,0 +321,0 @@ case ELEMENT_NODE_END: |
@@ -32,7 +32,5 @@ import {escape} from 'html-escaper'; | ||
toString() { | ||
let {ownerElement, name, _value} = this; | ||
if (name === 'style' && ownerElement) | ||
_value = ownerElement.style.cssText; | ||
let {name, _value} = this; | ||
return _value ? `${name}="${escape(_value)}"` : name; | ||
} | ||
} |
@@ -42,3 +42,3 @@ import uhyphen from 'uhyphen'; | ||
else { | ||
const attr = updateKeys(style); | ||
let attr = updateKeys(style); | ||
if (value == null) | ||
@@ -48,8 +48,10 @@ style.delete(uhyphen(name)); | ||
style.set(uhyphen(name), value); | ||
if (attr) { | ||
attr._value = style.toString(); | ||
attr._changed = false; | ||
if (!attr) { | ||
const element = refs.get(style); | ||
attr = element.ownerDocument.createAttribute('style'); | ||
element.setAttributeNode(attr); | ||
style.set(DOM, attr); | ||
} | ||
else | ||
style.cssText = style.toString(); | ||
attr._value = style.toString(); | ||
attr._changed = false; | ||
} | ||
@@ -81,3 +83,4 @@ return true; | ||
toString() { | ||
get[DOM]() { | ||
updateKeys(this); | ||
const cssText = []; | ||
@@ -90,4 +93,6 @@ this.forEach((value, key) => { | ||
} | ||
toString() { return this[DOM]; } | ||
} | ||
const {prototype} = CSSStyleDeclaration; |
@@ -317,9 +317,3 @@ import {ELEMENT_NODE, ELEMENT_NODE_END, ATTRIBUTE_NODE, TEXT_NODE, COMMENT_NODE} from './constants.js'; | ||
case ATTRIBUTE_NODE: | ||
if (_next.name === 'style') { | ||
const value = _next.toString(); | ||
if (value !== 'style') | ||
out.push(' ' + value); | ||
} | ||
else | ||
out.push(' ' + _next); | ||
out.push(' ' + _next); | ||
break; | ||
@@ -326,0 +320,0 @@ case ELEMENT_NODE_END: |
{ | ||
"name": "linkedom", | ||
"version": "0.1.21", | ||
"version": "0.1.22", | ||
"description": "A triple-linked lists based DOM", | ||
@@ -5,0 +5,0 @@ "main": "./cjs/index.js", |
1515814
4364