7
7
/*globals CustomEvent, CoCreate*/
8
8
import observer from '@cocreate/observer' ;
9
9
import action from '@cocreate/actions' ;
10
- import { queryDocumentSelectorAll } from '@cocreate/utils' ;
10
+ import { queryElements } from '@cocreate/utils' ;
11
11
12
12
// TODO: update to listen to document events, find closest action return
13
13
function init ( ) {
@@ -48,10 +48,10 @@ function selectShowHideEle(e) {
48
48
if ( value != '' ) {
49
49
var show = opt . getAttribute ( 'show' ) ;
50
50
if ( typeof show != 'undefined' ) {
51
- for ( let el of queryDocumentSelectorAll ( show ) )
51
+ for ( let el of queryElements ( { element : document , selector : show , type : 'selector' } ) )
52
52
el . setAttribute ( 'hidden' , '' ) ;
53
53
if ( opt . selected === true ) {
54
- for ( let el of queryDocumentSelectorAll ( show ) )
54
+ for ( let el of queryElements ( { element : document , selector : show , type : 'selector' } ) )
55
55
el . removeAttribute ( 'hidden' ) ;
56
56
}
57
57
}
@@ -74,12 +74,11 @@ function clickShowHideEle(e) {
74
74
75
75
show = radio . getAttribute ( 'show' ) ;
76
76
77
- for ( let el of queryDocumentSelectorAll ( show ) ) {
77
+ for ( let el of queryElements ( { element : document , selector : show , type : 'selector' } ) )
78
78
el . setAttribute ( 'hidden' , '' ) ;
79
- }
80
79
81
80
if ( radio . checked ) {
82
- for ( let el of queryDocumentSelectorAll ( show ) )
81
+ for ( let el of queryElements ( { element : document , selector : show , type : 'selector' } ) )
83
82
el . removeAttribute ( 'hidden' ) ;
84
83
}
85
84
}
@@ -88,14 +87,14 @@ function clickShowHideEle(e) {
88
87
89
88
let updated_els = [ ] ;
90
89
91
- for ( let el of queryDocumentSelectorAll ( show ) ) {
90
+ for ( let el of queryElements ( { element : document , selector : show , type : 'selector' } ) ) {
92
91
if ( el . hasAttribute ( 'hidden' ) ) {
93
92
el . removeAttribute ( 'hidden' ) ;
94
93
updated_els . push ( el ) ;
95
94
}
96
95
}
97
96
98
- for ( let el of queryDocumentSelectorAll ( hide ) ) {
97
+ for ( let el of queryElements ( { element : document , selector : hide , type : 'selector' } ) ) {
99
98
let existEqual = false ;
100
99
for ( let uel of updated_els ) {
101
100
if ( el . isEqualNode ( uel ) ) {
0 commit comments