| 132 | } |
| 133 | |
| 134 | function assignAttributes(obj, attrMap, readonlyMatcher, options) { |
| 135 | if (attrMap) { |
| 136 | const keys = Object.keys(attrMap); |
| 137 | const len = keys.length; //don't make it inline |
| 138 | for (let i = 0; i < len; i++) { |
| 139 | const atrrName = keys[i]; // This is the PREFIXED name (e.g., "@_class") |
| 140 | |
| 141 | // Strip prefix for matcher path (for isArray callback) |
| 142 | const rawAttrName = atrrName.startsWith(options.attributeNamePrefix) |
| 143 | ? atrrName.substring(options.attributeNamePrefix.length) |
| 144 | : atrrName; |
| 145 | |
| 146 | // For attributes, we need to create a temporary path |
| 147 | // Pass jPath string or matcher based on options.jPath setting |
| 148 | const jPathOrMatcher = options.jPath |
| 149 | ? readonlyMatcher.toString() + "." + rawAttrName |
| 150 | : readonlyMatcher; |
| 151 | |
| 152 | if (options.isArray(atrrName, jPathOrMatcher, true, true)) { |
| 153 | obj[atrrName] = [attrMap[atrrName]]; |
| 154 | } else { |
| 155 | obj[atrrName] = attrMap[atrrName]; |
| 156 | } |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | function isLeafTag(obj, options) { |
| 162 | const { textNodeName } = options; |