Problem/Motivation
I am using angularJS ngRoute which using the hash structure to perserve the route of the page. Opening a model window with an form in it (non-iframe) causes a syntax error
The line that is causing the error:
if (window.location.hash && $(this).find(window.location.hash).length) {
tab_focus = $(this).find(window.location.hash).closest('.vertical-tabs-pane');
}
else {
tab_focus = $('> .vertical-tabs-pane:first', this);
}
I believe because the hash is #/url and it doesn't like the / but not totally certian.
Steps to reproduce
Proposed resolution
Remaining tasks
Add a test.
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#24 | 2492993-24.patch | 1.15 KB | ranjith_kumar_k_u |
| |||
#23 | 2492993-nr-bot.txt | 157 bytes | needs-review-queue-bot |
#14 | syntax_error-2492993-14.patch | 1.38 KB | RumyanaRuseva |
#1 | 2492993-drupal-hash-1.patch | 1.33 KB | hefox |
Comments
Comment #1
hefox CreditAttribution: hefox commentedAdds a quick check for hash != #/, probably a prettier way to do this (.e.g "is hash a valid selector")
Comment #2
hefox CreditAttribution: hefox commentedComment #3
cilefen CreditAttribution: cilefen commentedAccording to policy, new issues should be opened against the main production branch, then back-ported.
Comment #4
droplet CreditAttribution: droplet commentedLuckily we only used it within jQuery.find() in ALL drupal version.... :) (@see: http://bugs.jquery.com/ticket/9521)
It should be filter out all invalid #ID. (I could imagine some script may use `#!`, or other similar patterns)
Here's a regex can do the job:
https://github.com/jquery/jquery/blob/master/src/core/init.js#L16
Comment #5
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedComment #8
nod_This still an issue?
Comment #9
gooddesignusa CreditAttribution: gooddesignusa commentedHere is a better solution. The same fix can be applied to D8
https://www.drupal.org/node/2843145
Comment #14
RumyanaRuseva CreditAttribution: RumyanaRuseva at FFW commentedYes, this is still an issue, and it's easily reproducible when there is an invalid character in the fragment (=%;,/). A similar issue exists in other scripts, and in #2395065: Certain URL fragments cause javascript error it's discussed whether we should check for invalid characters, or we should check for the valid ones.
Here is a patch for excluding the invalid characters.
Comment #15
RumyanaRuseva CreditAttribution: RumyanaRuseva at FFW commentedComment #22
quietone CreditAttribution: quietone at PreviousNext commentedThis was a bugsmash daily target. lendude suggests that this needs javascript test coverage to make sure the problem still exists. Therefor, I am adding the testing tag.
Comment #23
needs-review-queue-bot CreditAttribution: needs-review-queue-bot as a volunteer commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #24
ranjith_kumar_k_u CreditAttribution: ranjith_kumar_k_u as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedRe-rolled #14