als-document 0.11.0 → 0.12.0
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/document.js +3 -1
- package/package.json +1 -1
- package/readme.md +4 -0
package/document.js
CHANGED
|
@@ -154,6 +154,8 @@ class Document {
|
|
|
154
154
|
obj.order = this.types[tagName].count
|
|
155
155
|
} else obj.order = ''
|
|
156
156
|
obj.attributes = this.getAttributes(string)
|
|
157
|
+
obj.getAttribute = (attName) => obj.attributes[attName]
|
|
158
|
+
obj.setAttribute = (attName,attValue) => {obj.attributes[attName] = attValue}
|
|
157
159
|
obj = this.buildClass(obj)
|
|
158
160
|
if(obj.attributes.id !== undefined) {
|
|
159
161
|
obj.id = obj.attributes.id
|
|
@@ -553,7 +555,7 @@ class Document {
|
|
|
553
555
|
|
|
554
556
|
static removeMethods(element) {
|
|
555
557
|
element = {...element}
|
|
556
|
-
let deleteThis = ['parent','next','prev','classList','json','$','$$','remove','add','add0','add1','add2','add3']
|
|
558
|
+
let deleteThis = ['parent','next','prev','classList','json','$','$$','remove','add','add0','add1','add2','add3','getAttribute','setAttribute']
|
|
557
559
|
deleteThis.forEach(item => {
|
|
558
560
|
delete element[item]
|
|
559
561
|
});
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -10,6 +10,8 @@ You can select elements and collections and read and modify them with given inst
|
|
|
10
10
|
**0.11**
|
|
11
11
|
* events issue fixed
|
|
12
12
|
|
|
13
|
+
**0.12**
|
|
14
|
+
* added getAttribute and setAttribute
|
|
13
15
|
|
|
14
16
|
## Write and Read files
|
|
15
17
|
Document have 2 static methods to read and write files.
|
|
@@ -83,6 +85,8 @@ Each returned element, has the folowing:
|
|
|
83
85
|
id, // id of element if exists (not included in attributes)
|
|
84
86
|
attributes, // object of attributes (id not included)
|
|
85
87
|
classList, // array of classes and add and remove methods
|
|
88
|
+
getAttribute(name)
|
|
89
|
+
setAttribute(name,value)
|
|
86
90
|
$(selector),
|
|
87
91
|
$$(selector),
|
|
88
92
|
json(), // remove all methods and circular objects from object
|