highmark-markdown 0.0.109 → 0.0.112

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.
@@ -46,22 +46,15 @@ class MarkdownNode extends NonTerminalNode {
46
46
  startingTag(context) {
47
47
  const tagName = this.tagName(context),
48
48
  className = this.className(context),
49
- attributeName = this.attributeName(context);
50
-
51
- let classHTML = EMPTY_STRING,
52
- attributeHTML = EMPTY_STRING;
53
-
54
- if (className !== null) {
55
- classHTML = ` class="${className}"`;
56
- }
57
-
58
- if (attributeName !== null) {
59
- const attributeValue = this.attributeValue(context);
60
-
61
- attributeHTML = ` ${attributeName}="${attributeValue}"`;
62
- }
63
-
64
- const startingTag = `<${tagName}${classHTML}${attributeHTML}>`;
49
+ attributeName = this.attributeName(context),
50
+ attributeValue = this.attributeValue(context),
51
+ classHTML = (className !== null) ?
52
+ ` class="${className}"` :
53
+ EMPTY_STRING,
54
+ attributeHTML = ((attributeName !== null) && (attributeValue !== null)) ?
55
+ ` ${attributeName}="${attributeValue}"` :
56
+ EMPTY_STRING,
57
+ startingTag = `<${tagName}${classHTML}${attributeHTML}>`;
65
58
 
66
59
  return startingTag;
67
60
  }
@@ -69,22 +62,15 @@ class MarkdownNode extends NonTerminalNode {
69
62
  selfClosingTag(context) {
70
63
  const tagName = this.tagName(context),
71
64
  className = this.className(context),
72
- attributeName = this.attributeName(context);
73
-
74
- let classHTML = EMPTY_STRING,
75
- attributeHTML = EMPTY_STRING;
76
-
77
- if (className !== null) {
78
- classHTML = ` class="${className}"`;
79
- }
80
-
81
- if (attributeName !== null) {
82
- const attributeValue = this.attributeValue(context);
83
-
84
- attributeHTML = ` ${attributeName}="${attributeValue}"`;
85
- }
86
-
87
- const selfClosingTag = `<${tagName}${classHTML}${attributeHTML}/>`;
65
+ attributeName = this.attributeName(context),
66
+ attributeValue = this.attributeValue(context),
67
+ classHTML = (className !== null) ?
68
+ ` class="${className}"` :
69
+ EMPTY_STRING,
70
+ attributeHTML = ((attributeName !== null) && (attributeValue !== null)) ?
71
+ ` ${attributeName}="${attributeValue}"` :
72
+ EMPTY_STRING,
73
+ selfClosingTag = `<${tagName}${classHTML}${attributeHTML}/>`;
88
74
 
89
75
  return selfClosingTag;
90
76
  }
@@ -177,22 +163,20 @@ ${indent}${closingTag}
177
163
  if (tagName !== null) {
178
164
  domElement = document.createElement(tagName);
179
165
 
180
- this.setDOMElement(domElement);
181
-
182
166
  const className = this.className(context),
183
167
  attributeName = this.attributeName(context),
184
168
  attributeValue = this.attributeValue(context);
185
169
 
186
170
  if (className !== null) {
187
- Object.assign(domElement, {
188
- className
189
- });
171
+ domElement.className = className;
190
172
  }
191
173
 
192
174
  if ((attributeName !== null) && (attributeValue !== null)) {
193
175
  domElement.setAttribute(attributeName, attributeValue);
194
176
  }
195
177
 
178
+ this.setDOMElement(domElement);
179
+
196
180
  this.createChildNodeDOMElements(context);
197
181
  }
198
182