Remove special react handling from html, it has been managed fix
fixAttributes in react.
Showing
2 changed files
with
1 additions
and
18 deletions
| ... | @@ -356,12 +356,6 @@ export const createAdjuster = (adjustments = {}) => { | ... | @@ -356,12 +356,6 @@ export const createAdjuster = (adjustments = {}) => { | 
| 356 | return adjuster | 356 | return adjuster | 
| 357 | } | 357 | } | 
| 358 | 358 | ||
| 359 | const reactAttributeMap = { | ||
| 360 | 'class': 'className', | ||
| 361 | 'srcset': 'srcSet', | ||
| 362 | 'maxlength': 'maxLength', | ||
| 363 | } | ||
| 364 | |||
| 365 | class NodeProxyHandler { | 359 | class NodeProxyHandler { | 
| 366 | #options | 360 | #options | 
| 367 | #cache | 361 | #cache | 
| ... | @@ -379,15 +373,7 @@ class NodeProxyHandler { | ... | @@ -379,15 +373,7 @@ class NodeProxyHandler { | 
| 379 | if (!origValue) return origValue | 373 | if (!origValue) return origValue | 
| 380 | switch (prop) { | 374 | switch (prop) { | 
| 381 | case 'attributes': | 375 | case 'attributes': | 
| 382 | return this.#cache[ prop ] = (origValue ? Object.fromEntries(Object.entries(origValue).map(([ key, value ]) => { | 376 | return this.#cache[ prop ] = origValue | 
| 383 | const decoded = decode(value) | ||
| 384 | if (this.#options.react) { | ||
| 385 | const { [ key ]: newKey } = reactAttributeMap | ||
| 386 | if (newKey) return [ newKey, decoded ] | ||
| 387 | } | ||
| 388 | return [ key, decoded ] | ||
| 389 | })) : origValue) | ||
| 390 | return newValue | ||
| 391 | case 'parent': | 377 | case 'parent': | 
| 392 | return this.#parent | 378 | return this.#parent | 
| 393 | case 'children': | 379 | case 'children': | ... | ... | 
| ... | @@ -25,9 +25,6 @@ export const fixAttributes = (attributes) => { | ... | @@ -25,9 +25,6 @@ export const fixAttributes = (attributes) => { | 
| 25 | if (maxLength !== undefined) result.maxLength = maxLength | 25 | if (maxLength !== undefined) result.maxLength = maxLength | 
| 26 | if (htmlFor !== undefined) result.htmlFor = htmlFor | 26 | if (htmlFor !== undefined) result.htmlFor = htmlFor | 
| 27 | return result | 27 | return result | 
| 28 | return Object.fromEntries(Object.entries(result).map(([ key, value ]) => { | ||
| 29 | return [ key, decode(value) ] | ||
| 30 | })) | ||
| 31 | } | 28 | } | 
| 32 | 29 | ||
| 33 | export const CreateReplacement = (Element, propsOrCreator) => (matchOptions) => { | 30 | export const CreateReplacement = (Element, propsOrCreator) => (matchOptions) => { | ... | ... | 
- 
Please register or sign in to post a comment