Closed Bug 544535 Opened 10 years ago Closed 9 years ago

Ignore push/replaceState's title argument


(Core :: DOM: Core & HTML, defect)

Not set





(Reporter: justin.lebar+bug, Assigned: justin.lebar+bug)




(1 file)

Our current implementation of the title argument in history.push/replaceState is unsatisfactory.

Currently, calling |history.replaceState(null, "foo");| changes the session history entry's title (seen when you press the down arrow next to the forward button) to "foo".  But when the page is re-visited (e.g. the user goes back then forward), its shentry's title is set back to the value in document.title.

If there is a title parameter, it should probably be persisted in the shentry.  The way this would work, I think, is that changes to document.title would be reflected in the shentry's title, as they are now, unless the shentry was created by a pushState or modified by a replaceState.  In that case, changes to document.title don't affect the shentry's title; the shentry's title can only be changed by calling replaceState.

I've argued on whatwg [1] that we should get rid of the title parameter from push/replaceState altogether, because I think the solution above adds a lot of complication for very little gain.  My arguments didn't get much traction at the time, however.

I think we should either push to get the title parameter removed from pushState, implement the above strategy for persisting shentry titles, or come up with an alternative strategy.

Pinging Jonas and Smaug on this issue.  I think we need to resolve this one way or another before we start seriously evangelizing pushState.
Perhaps we should start ignoring the title argument to establish parity with what WebKit currently does?  We can always change it later to reflect our proposal to WhatWG that the pushState title affect document.title.
That sounds good to me. I'd even be ok with implementing our proposal, both to show we are serious, and to gather implementation experience.
Easy patch to ignore the title parameter, if we want to take it.
Assignee: nobody → justin.lebar+bug
Attachment #457130 - Flags: review?(jonas)
Blocks: 580066
Comment on attachment 457130 [details] [diff] [review]
Patch to ignore the title

Jonas and I think we should check this in now.  We can always hook the title parameter up to document.title later.
Attachment #457130 - Flags: approval2.0?
Attachment #457130 - Flags: approval2.0? → approval2.0+
Summary: Fix title argument implementation in history.push/replaceState → Ignore push/replaceState's title argument
Closed: 9 years ago
Resolution: --- → FIXED
No longer blocks: 580066
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.