11import canUseDom from './canUseDom' ;
22
3- const APPEND_ORDER = '_rc_util_order ' ;
3+ const APPEND_ORDER = 'data-rc-order ' ;
44const MARK_KEY = `rc-util-key` ;
55
66const containerCache = new Map < Element , Node & ParentNode > ( ) ;
@@ -46,7 +46,7 @@ function findStyles(container: Element) {
4646 return Array . from (
4747 ( containerCache . get ( container ) || container ) . children ,
4848 ) . filter (
49- node => node . tagName === 'STYLE' && node [ APPEND_ORDER ] ,
49+ node => node . tagName === 'STYLE' && node . hasAttribute ( APPEND_ORDER ) ,
5050 ) as HTMLStyleElement [ ] ;
5151}
5252
@@ -58,7 +58,7 @@ export function injectCSS(css: string, option: Options = {}) {
5858 const { csp, prepend } = option ;
5959
6060 const styleNode = document . createElement ( 'style' ) ;
61- styleNode [ APPEND_ORDER ] = getOrder ( prepend ) ;
61+ styleNode . setAttribute ( APPEND_ORDER , getOrder ( prepend ) ) ;
6262
6363 if ( csp ?. nonce ) {
6464 styleNode . nonce = csp ?. nonce ;
@@ -72,7 +72,7 @@ export function injectCSS(css: string, option: Options = {}) {
7272 // If is queue `prepend`, it will prepend first style and then append rest style
7373 if ( prepend === 'queue' ) {
7474 const existStyle = findStyles ( container ) . filter ( node =>
75- [ 'prepend' , 'prependQueue' ] . includes ( node [ APPEND_ORDER ] ) ,
75+ [ 'prepend' , 'prependQueue' ] . includes ( node . getAttribute ( APPEND_ORDER ) ) ,
7676 ) ;
7777 if ( existStyle . length ) {
7878 container . insertBefore (
0 commit comments