@@ -51,7 +51,14 @@ export function applyDiff(
5151
5252 switch ( action ) {
5353 case options . _const . addAttribute :
54- if ( ! node || ! checkElementType ( node , options . simplifiedElementCheck , "Element" ) ) {
54+ if (
55+ ! node ||
56+ ! checkElementType (
57+ node ,
58+ options . simplifiedElementCheck ,
59+ "Element" ,
60+ )
61+ ) {
5562 return false
5663 }
5764 node . setAttribute (
@@ -60,28 +67,49 @@ export function applyDiff(
6067 )
6168 break
6269 case options . _const . modifyAttribute :
63- if ( ! node || ! checkElementType ( node , options . simplifiedElementCheck , "Element" ) ) {
70+ if (
71+ ! node ||
72+ ! checkElementType (
73+ node ,
74+ options . simplifiedElementCheck ,
75+ "Element" ,
76+ )
77+ ) {
6478 return false
6579 }
6680 node . setAttribute (
6781 diff [ options . _const . name ] as string ,
6882 diff [ options . _const . newValue ] as string ,
6983 )
7084 if (
71- checkElementType ( node , options . simplifiedElementCheck , "HTMLInputElement" ) &&
85+ checkElementType (
86+ node ,
87+ options . simplifiedElementCheck ,
88+ "HTMLInputElement" ,
89+ ) &&
7290 diff [ options . _const . name ] === "value"
7391 ) {
7492 node . value = diff [ options . _const . newValue ] as string
7593 }
7694 break
7795 case options . _const . removeAttribute :
78- if ( ! node || ! checkElementType ( node , options . simplifiedElementCheck , "Element" ) ) {
96+ if (
97+ ! node ||
98+ ! checkElementType (
99+ node ,
100+ options . simplifiedElementCheck ,
101+ "Element" ,
102+ )
103+ ) {
79104 return false
80105 }
81106 node . removeAttribute ( diff [ options . _const . name ] as string )
82107 break
83108 case options . _const . modifyTextElement :
84- if ( ! node || ! checkElementType ( node , options . simplifiedElementCheck , "Text" ) ) {
109+ if (
110+ ! node ||
111+ ! checkElementType ( node , options . simplifiedElementCheck , "Text" )
112+ ) {
85113 return false
86114 }
87115 options . textDiff (
@@ -90,7 +118,13 @@ export function applyDiff(
90118 diff [ options . _const . oldValue ] as string ,
91119 diff [ options . _const . newValue ] as string ,
92120 )
93- if ( checkElementType ( node . parentNode , options . simplifiedElementCheck , "HTMLTextAreaElement" ) ) {
121+ if (
122+ checkElementType (
123+ node . parentNode ,
124+ options . simplifiedElementCheck ,
125+ "HTMLTextAreaElement" ,
126+ )
127+ ) {
94128 node . parentNode . value = diff [ options . _const . newValue ] as string
95129 }
96130 break
@@ -101,7 +135,14 @@ export function applyDiff(
101135 node . value = diff [ options . _const . newValue ]
102136 break
103137 case options . _const . modifyComment :
104- if ( ! node || ! checkElementType ( node , options . simplifiedElementCheck , "Comment" ) ) {
138+ if (
139+ ! node ||
140+ ! checkElementType (
141+ node ,
142+ options . simplifiedElementCheck ,
143+ "Comment" ,
144+ )
145+ ) {
105146 return false
106147 }
107148 options . textDiff (
@@ -161,7 +202,13 @@ export function applyDiff(
161202 const parentRoute = route . slice ( )
162203 const c : number = parentRoute . splice ( parentRoute . length - 1 , 1 ) [ 0 ]
163204 node = getFromRoute ( tree , parentRoute )
164- if ( ! checkElementType ( node , options . simplifiedElementCheck , "Element" ) ) {
205+ if (
206+ ! checkElementType (
207+ node ,
208+ options . simplifiedElementCheck ,
209+ "Element" ,
210+ )
211+ ) {
165212 return false
166213 }
167214 node . insertBefore (
@@ -180,7 +227,13 @@ export function applyDiff(
180227 }
181228 const parentNode = node . parentNode
182229 parentNode . removeChild ( node )
183- if ( checkElementType ( parentNode , options . simplifiedElementCheck , "HTMLTextAreaElement" ) ) {
230+ if (
231+ checkElementType (
232+ parentNode ,
233+ options . simplifiedElementCheck ,
234+ "HTMLTextAreaElement" ,
235+ )
236+ ) {
184237 parentNode . value = ""
185238 }
186239 break
@@ -196,7 +249,13 @@ export function applyDiff(
196249 return false
197250 }
198251 node . insertBefore ( newNode , node . childNodes [ c ] || null )
199- if ( checkElementType ( node . parentNode , options . simplifiedElementCheck , "HTMLTextAreaElement" ) ) {
252+ if (
253+ checkElementType (
254+ node . parentNode ,
255+ options . simplifiedElementCheck ,
256+ "HTMLTextAreaElement" ,
257+ )
258+ ) {
200259 node . parentNode . value = diff [ options . _const . value ] as string
201260 }
202261 break
0 commit comments