File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ interface CustomElement {
1111 */
1212export function register ( classObject : CustomElement ) : void {
1313 const name = classObject . name
14- . replace ( / ( [ A - Z ] [ a - z ] ) / g, '-$1' )
14+ . replace ( / ( [ A - Z ] ( $ | [ a - z ] ) ) / g, '-$1' )
1515 . replace ( / ( ^ - | - E l e m e n t $ ) / , '' )
1616 . toLowerCase ( )
1717 if ( ! window . customElements . get ( name ) ) {
Original file line number Diff line number Diff line change @@ -34,6 +34,12 @@ describe('register', () => {
3434 expect ( window . customElements . get ( 'url-bar' ) ) . to . equal ( URLBar )
3535 } )
3636
37+ it ( 'dasherizes cap suffixed names correctly' , ( ) => {
38+ class ClipX { }
39+ register ( ClipX )
40+ expect ( window . customElements . get ( 'clip-x' ) ) . to . equal ( ClipX )
41+ } )
42+
3743 it ( 'automatically drops the `Element` suffix' , ( ) => {
3844 class ASuffixedElement { }
3945 register ( ASuffixedElement )
You can’t perform that action at this time.
0 commit comments