@danielgindi/dom-utils 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Dom.js CHANGED
@@ -38,7 +38,7 @@ const setElementAttrs = function (el, attrs) {
38
38
  el.innerHTML = String(value);
39
39
  else if (key === 'css' && 'style' in el)
40
40
  setCssProps(el, value);
41
- else if (key === 'readOnly' || key === 'tabIndex' || key === 'textContent')
41
+ else if (key in el && key !== 'style')
42
42
  el[key] = value;
43
43
  else el.setAttribute(key, String(value));
44
44
  }
@@ -115,10 +115,18 @@ const next = function (el, selector) {
115
115
  return null;
116
116
  };
117
117
 
118
+ const unwrapChildren = function (el) {
119
+ let parent = el.parentNode;
120
+ while (el.firstChild)
121
+ parent.insertBefore(el.firstChild, el);
122
+ parent.removeChild(el);
123
+ };
124
+
118
125
  export {
119
126
  createElement,
120
127
  setElementAttrs,
121
128
  closestUntil,
122
129
  prev,
123
130
  next,
131
+ unwrapChildren,
124
132
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielgindi/dom-utils",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "A collection of dom utilities. So you can work natively with the dom without dom frameworks.",
5
5
  "main": "dist/lib.cjs.min.js",
6
6
  "module": "lib/index.js",