@@ -282,6 +282,19 @@ def highlight_with_js(driver, selector, loops, o_bs):
282
282
driver .execute_script ("" )
283
283
except Exception :
284
284
pass
285
+ if selector == "html" :
286
+ selector = "body"
287
+ selector_no_spaces = selector .replace (" " , "" )
288
+ early_exit = False
289
+ if '[style=\\ "' in selector_no_spaces :
290
+ if 'box\\ -shadow:' in selector :
291
+ early_exit = True # Changing the box-shadow changes the selector
292
+ elif '[style=\\ "' in selector :
293
+ selector = selector .replace ('[style=\\ "' , '[style\\ *=\\ "' )
294
+ else :
295
+ early_exit = True # Changing the box-shadow changes the selector
296
+ if early_exit :
297
+ return
285
298
script = (
286
299
"""document.querySelector('%s').style.boxShadow =
287
300
'0px 0px 6px 6px rgba(128, 128, 128, 0.5)';"""
@@ -369,6 +382,19 @@ def highlight_with_jquery(driver, selector, loops, o_bs):
369
382
driver .execute_script ("" )
370
383
except Exception :
371
384
pass
385
+ if selector == "html" :
386
+ selector = "body"
387
+ selector_no_spaces = selector .replace (" " , "" )
388
+ early_exit = False
389
+ if '[style=\\ "' in selector_no_spaces :
390
+ if 'box\\ -shadow:' in selector :
391
+ early_exit = True # Changing the box-shadow changes the selector
392
+ elif '[style=\\ "' in selector :
393
+ selector = selector .replace ('[style=\\ "' , '[style\\ *=\\ "' )
394
+ else :
395
+ early_exit = True # Changing the box-shadow changes the selector
396
+ if early_exit :
397
+ return
372
398
script = (
373
399
"""jQuery('%s').css('box-shadow',
374
400
'0px 0px 6px 6px rgba(128, 128, 128, 0.5)');"""
@@ -757,6 +783,22 @@ def highlight_with_js_2(driver, message, selector, o_bs, msg_dur):
757
783
pass
758
784
if selector == "html" :
759
785
selector = "body"
786
+ selector_no_spaces = selector .replace (" " , "" )
787
+ early_exit = False
788
+ if '[style=\\ "' in selector_no_spaces :
789
+ if 'box\\ -shadow:' in selector :
790
+ early_exit = True # Changing the box-shadow changes the selector
791
+ elif '[style=\\ "' in selector :
792
+ selector = selector .replace ('[style=\\ "' , '[style\\ *=\\ "' )
793
+ else :
794
+ early_exit = True # Changing the box-shadow changes the selector
795
+ if early_exit :
796
+ try :
797
+ activate_jquery (driver )
798
+ post_messenger_success_message (driver , message , msg_dur )
799
+ except Exception :
800
+ pass
801
+ return
760
802
script = (
761
803
"""document.querySelector('%s').style.boxShadow =
762
804
'0px 0px 6px 6px rgba(128, 128, 128, 0.5)';"""
@@ -827,6 +869,22 @@ def highlight_with_js_2(driver, message, selector, o_bs, msg_dur):
827
869
def highlight_with_jquery_2 (driver , message , selector , o_bs , msg_dur ):
828
870
if selector == "html" :
829
871
selector = "body"
872
+ selector_no_spaces = selector .replace (" " , "" )
873
+ early_exit = False
874
+ if '[style=\\ "' in selector_no_spaces :
875
+ if 'box\\ -shadow:' in selector :
876
+ early_exit = True # Changing the box-shadow changes the selector
877
+ elif '[style=\\ "' in selector :
878
+ selector = selector .replace ('[style=\\ "' , '[style\\ *=\\ "' )
879
+ else :
880
+ early_exit = True # Changing the box-shadow changes the selector
881
+ if early_exit :
882
+ try :
883
+ activate_jquery (driver )
884
+ post_messenger_success_message (driver , message , msg_dur )
885
+ except Exception :
886
+ pass
887
+ return
830
888
script = (
831
889
"""jQuery('%s').css('box-shadow',
832
890
'0px 0px 6px 6px rgba(128, 128, 128, 0.5)');"""
0 commit comments