-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make quirk detection optional #9
Comments
I agree. However, I'm undecided how to realize this "disable-quirk-detection" switch. The quirk detection is done at the moment the DOM is ready (i.e. before the first call to <body data-jquery-simulate-ext-opts='{"disable-quirk-detection": true}'>
<!-- ... -->
</body> Would this be a reasonable solution for you, i.e. changing your body element as shown above? |
Alternatively, I could create a configuration function ( <html>
<head>
<!-- ... -->
<script type="text/javascript" src="../libs/jquery.simulate.js"></script>
<script type="text/javascript" src="../src/jquery.simulate.ext.js"></script>
<script type="text/javascript" src="../src/jquery.simulate.drag-n-drop.js"></script>
<script type="text/javascript" src="../src/jquery.simulate.key-sequence.js"></script>
<script type="text/javascript" src="../src/jquery.simulate.key-combo.js"></script>
<script type="text/javascript">
$.simulate.prototype.disableQuirkDetection();
</script>
<!-- ... -->
<body>
<!-- ... -->
</body>
</html> The drawback of this solution is that is not possible to disable the quirk detection when the simulate-ext files are included dynamically because the quirk detection would be executed immediately after the scripts are attached to the DOM. |
Cool, thanks for thinking seriously about this. How about detecting a flag on the window object? I'd imagined doing something like this to turn off the detection: window.JQ_SIM_EXT_DISABLE_QUIRK_DETECTION = true; It's not the most aesthetic kind of flag, but that would let someone disable the quirk detection at any point before it's run. By the way, I really enjoyed using the simulate-ext plugin. It was easy to set up and immediately helped us with a tricky keystroke simulation problem we had encountered. Many thanks for that. |
I don't like to pollute the window or jQuery object but setting a flag seems the best way. Therefore, I think I'll use a variable in the jQuery simulate object. This requires that the flag is set after jQuery simulate is loaded or the flag will be overridden. However, I think that's a reasonable restriction even if the scripts are loaded dynamically (the flag could be set in a callback or the like): <!-- ... -->
<script type="text/javascript" src="../libs/jquery.simulate.js"></script>
<script type="text/javascript">$.simulate.ext_disableQuirkDetection = true;</script>
<script type="text/javascript" src="../src/jquery.simulate.ext.js"></script>
<!-- ... --> PS: I'm glad to hear you like the plugin. :-) |
That looks good. Thanks for being responsive on this. I know it's a small thing, but somehow the quirk detection was making our application implode unless it was turned off, so I'm happy to see the option there. |
Note that the plugin might not work as expected if the quirk detection is disabled. Therefore, I added the possibility <!-- ... -->
<script type="text/javascript" src="../libs/jquery.simulate.js"></script>
<script type="text/javascript">$.simulate.ext_disableQuirkDetection = true;</script>
<script type="text/javascript" src="../src/jquery.simulate.ext.js"></script>
<script type="text/javascript" src="../src/jquery.simulate.key-sequence.js"></script>
<script type="text/javascript">$.simulate.prototype.quirks.delayedSpacesInNonInputGlitchToEnd = true;</script>
<!-- ... --> For more information on the quirks and their fixes, see the inline documentation in the source code. |
ctrl+v or control+v doesn't work :( |
See #30 |
I'm using jquery-simulate-ext in a content-script environment where the DOM is fragile and behavior changes unexpectedly when DIVs are inserted or removed.
I tracked down one of our problems to the DOM manipulation that the key-sequence plugin uses to detect a quirk (i.e., https://github.com/j-ulrich/jquery-simulate-ext/blob/master/src/jquery.simulate.key-sequence.js#L430). I'm removing these lines from my own fork, but if there were a way to optionally disable the quirk detection I would find that useful.
The text was updated successfully, but these errors were encountered: