File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 1
- const stripHtml = element => element ?. innerHTML ?. replace ( / < [ ^ > ] * > ? / gm, '' )
1
+ const stripHtml = element => {
2
+ if ( element && element . innerHTML ) {
3
+ return element . innerHTML . replace ( / < [ ^ > ] * > ? / gm, '' )
4
+ }
5
+
6
+ return null
7
+ }
2
8
3
9
const parseStrDimensionToInt = elementSize => parseInt ( elementSize , 10 )
4
10
@@ -46,10 +52,12 @@ const hasClass = (element, className) => {
46
52
}
47
53
48
54
const findFirstChildWithClassName = ( element , className ) => {
49
- const matches = element ?. getElementsByClassName ( className )
55
+ if ( element && element . getElementsByClassName ) {
56
+ const matches = element . getElementsByClassName ( className )
50
57
51
- if ( matches && matches . length > 0 ) {
52
- return matches [ 0 ]
58
+ if ( matches && matches . length > 0 ) {
59
+ return matches [ 0 ]
60
+ }
53
61
}
54
62
55
63
return null
You can’t perform that action at this time.
0 commit comments