als-document 0.1.1 → 0.11.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 CHANGED
@@ -73,7 +73,8 @@ class Document {
73
73
  if(scripts !== null) scripts.forEach((script,i) => {
74
74
  let scriptContent = script.replace(`on${event}`,'').replace('=','').replace(/\"/g,'')
75
75
  if(scriptContent.trim() !== '') {
76
- let scriptName = `{script${i}}`
76
+ let index = Object.keys(this.events).length
77
+ let scriptName = `{event${index}}`
77
78
  let newScript = script.replace(scriptContent,scriptName)
78
79
  this.events[scriptName] = scriptContent
79
80
  this.htmlText = this.htmlText.replace(script,newScript)
@@ -100,8 +101,10 @@ class Document {
100
101
  for(let attName in element.attributes) {
101
102
  let attValue = element.attributes[attName]
102
103
  if(this.events[attValue] !== undefined) {
103
- this.domList[i].attributes[attName] = this.events[attValue]
104
- delete this.events[attValue]
104
+ if(this.domList[i].attributes[attName] == attValue) {
105
+ this.domList[i].attributes[attName] = this.events[attValue]
106
+ delete this.events[attValue]
107
+ }
105
108
  }
106
109
  }
107
110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "als-document",
3
- "version": "0.1.1",
3
+ "version": "0.11.0",
4
4
  "description": "virtual dom",
5
5
  "main": "document.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -7,8 +7,8 @@ Document is a class which gets html as string and return new object with DOM tre
7
7
  You can add or remove elements from DOM tree and modify each element.
8
8
  You can select elements and collections and read and modify them with given instruments.
9
9
 
10
- **update**
11
- * querySelector for attributes fixed
10
+ **0.11**
11
+ * events issue fixed
12
12
 
13
13
 
14
14
  ## Write and Read files