@@ -282,6 +282,19 @@ def highlight_with_js(driver, selector, loops, o_bs):
282282 driver .execute_script ("" )
283283 except Exception :
284284 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
285298 script = (
286299 """document.querySelector('%s').style.boxShadow =
287300 '0px 0px 6px 6px rgba(128, 128, 128, 0.5)';"""
@@ -369,6 +382,19 @@ def highlight_with_jquery(driver, selector, loops, o_bs):
369382 driver .execute_script ("" )
370383 except Exception :
371384 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
372398 script = (
373399 """jQuery('%s').css('box-shadow',
374400 '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):
757783 pass
758784 if selector == "html" :
759785 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
760802 script = (
761803 """document.querySelector('%s').style.boxShadow =
762804 '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):
827869def highlight_with_jquery_2 (driver , message , selector , o_bs , msg_dur ):
828870 if selector == "html" :
829871 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
830888 script = (
831889 """jQuery('%s').css('box-shadow',
832890 '0px 0px 6px 6px rgba(128, 128, 128, 0.5)');"""
0 commit comments