Ticket #8085 (closed bug: wontfix)
Chrome and Safari updating elements that don't match selector, on browser back
| Reported by: | ghollins@… | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | attributes | Version: | 1.4.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
When coming back to a page via the browser back button under Chrome/Safari, some elements get wrong values. Please see the following simplified example:
Here are more details: http://stackoverflow.com/questions/4823457/jquery-finding-wrong-elements-under-chrome
Change History
comment:2 Changed 2 years ago by Galen Hollins <ghollins@…>
Sorry for modifying the example again, but this example more clearly shows that the weird form population only occurs when jQuery .val() methods are introduced. In the example, try commenting/uncommenting the
updateRowNums();
line of code:
comment:3 Changed 2 years ago by petersendidit
The problem is that your input's do not have a name attribute. Chrome/Safari seems to try to save what you entered in to form fields when you go forward and back in the history. Because your inputs do not have name attributes its guessing which input field to put the values back in, and is guessing incorrectly.
Add name attributes to your fields and its all fixed: http://jsfiddle.net/petersendidit/eGutT/14/
Chrome/Safari probably should be checking for the id attribute of the name attribute is missing.
comment:4 follow-up: ↓ 5 Changed 2 years ago by rwaldron
- Priority changed from undecided to low
- Resolution set to wontfix
- Status changed from new to closed
- Component changed from unfiled to attributes
I'm seeing this too, but it's not a jQuery bug by any means. This test: http://jsfiddle.net/rwaldron/UvmDv/7/ doesn't use jQuery and has the same behaviour.
I would suggest filing this here: https://bugs.webkit.org/
comment:5 in reply to: ↑ 4 Changed 2 years ago by Galen Hollins <ghollins@…>
Replying to rwaldron:
I'm seeing this too, but it's not a jQuery bug by any means. This test: http://jsfiddle.net/rwaldron/UvmDv/7/ doesn't use jQuery and has the same behaviour.
I would suggest filing this here: https://bugs.webkit.org/
Thanks! Yes, I agree this looks like a webkit bug. I've filed a bug with webkit. Thanks, Galen
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Here is another example, that's even more simplified:
http://jsfiddle.net/eGutT/9/
I'm not sure if this is a Chrome/Safari bug, or a jQuery bug...