diff --git a/src/js/popup.js b/src/js/popup.js
index e4ef8ae..b480bfc 100644
--- a/src/js/popup.js
+++ b/src/js/popup.js
@@ -482,7 +482,7 @@ var createMatrixGroup = function() {
if ( group ) {
return uDom(group).removeClass().addClass('matGroup');
}
- return uDom('
').addClass('matGroup');
+ return uDom(document.createElement('div')).addClass('matGroup');
};
var createMatrixSection = function() {
@@ -490,7 +490,7 @@ var createMatrixSection = function() {
if ( section ) {
return uDom(section).removeClass().addClass('matSection');
}
- return uDom('
').addClass('matSection');
+ return uDom(document.createElement('div')).addClass('matSection');
};
var createMatrixRow = function() {
diff --git a/src/js/udom.js b/src/js/udom.js
index 8d5b6a0..30bc60d 100644
--- a/src/js/udom.js
+++ b/src/js/udom.js
@@ -58,9 +58,6 @@ var DOMListFactory = function(selector, context) {
var r = new DOMList();
if ( typeof selector === 'string' ) {
selector = selector.trim();
- if ( selector.charAt(0) === '<' ) {
- return addHTMLToList(r, selector);
- }
if ( selector !== '' ) {
return addSelectorToList(r, selector, context);
}
@@ -85,6 +82,16 @@ DOMListFactory.onLoad = function(callback) {
/******************************************************************************/
+DOMListFactory.nodeFromId = function(id) {
+ return document.getElementById(id);
+};
+
+DOMListFactory.nodeFromSelector = function(selector) {
+ return document.querySelector(selector);
+};
+
+/******************************************************************************/
+
var addNodeToList = function(list, node) {
if ( node ) {
list.nodes.push(node);
@@ -125,51 +132,6 @@ var addSelectorToList = function(list, selector, context) {
/******************************************************************************/
-var pTagOfChildTag = {
- 'tr': 'table',
- 'option': 'select'
-};
-
-// TODO: documentFragment
-
-var addHTMLToList = function(list, html) {
- var matches = html.match(/^<([a-z]+)/);
- if ( !matches || matches.length !== 2 ) {
- return this;
- }
- var cTag = matches[1];
- var pTag = pTagOfChildTag[cTag] || 'div';
- var p = document.createElement(pTag);
- vAPI.insertHTML(p, html);
- // Find real parent
- var c = p.querySelector(cTag);
- p = c.parentNode;
- while ( p.firstChild ) {
- list.nodes.push(p.removeChild(p.firstChild));
- }
- return list;
-};
-
-/******************************************************************************/
-
-var isChildOf = function(child, parent) {
- return child !== null && parent !== null && child.parentNode === parent;
-};
-
-/******************************************************************************/
-
-var isDescendantOf = function(descendant, ancestor) {
- while ( descendant.parentNode !== null ) {
- if ( descendant.parentNode === ancestor ) {
- return true;
- }
- descendant = descendant.parentNode;
- }
- return false;
-};
-
-/******************************************************************************/
-
var nodeInNodeList = function(node, nodeList) {
var i = nodeList.length;
while ( i-- ) {
@@ -555,8 +517,14 @@ DOMList.prototype.css = function(prop, value) {
if ( value === undefined ) {
return i ? this.nodes[0].style[prop] : undefined;
}
+ if ( value !== '' ) {
+ while ( i-- ) {
+ this.nodes[i].style.setProperty(prop, value);
+ }
+ return this;
+ }
while ( i-- ) {
- this.nodes[i].style[prop] = value;
+ this.nodes[i].style.removeProperty(prop);
}
return this;
};