(content)
| 2129 | }; |
| 2130 | |
| 2131 | var extractAttributesFromString = function (content) { |
| 2132 | var attributes = {}; |
| 2133 | |
| 2134 | var pieces = content.split(/\s/); |
| 2135 | // Remove tag name. |
| 2136 | delete pieces[0]; |
| 2137 | |
| 2138 | pieces.forEach(function (element) { |
| 2139 | if (element.length === 0) { |
| 2140 | return; |
| 2141 | } |
| 2142 | if (element.indexOf('=') === -1) { |
| 2143 | attributes[element] = ''; |
| 2144 | } |
| 2145 | }); |
| 2146 | |
| 2147 | var attributesRegex = /(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?/gim; |
| 2148 | |
| 2149 | var result; |
| 2150 | while ((result = attributesRegex.exec(content))) { |
| 2151 | attributes[result[1]] = result[2]; |
| 2152 | } |
| 2153 | |
| 2154 | return attributes; |
| 2155 | }; |
| 2156 | |
| 2157 | var parser = new htmlparser2.Parser( |
| 2158 | { |
no outgoing calls
no test coverage detected
searching dependent graphs…