Adds fallbackMethod option for dynamic document titles
Adds `fallbackMethod` option for dynamic document titles
* `static` is the traditional behavior based on the original document title
* `dynamic` uses a regex to replace the title in the event the original document title changed since the script loaded
declare `titleSplit` variable
Hey, can you think of any reason why you would want to use the static method? I'm reluctant to add extra options unless really necessary :-)
This isn't fool-proof. If you started with a page title in the form (20) Some Text it would overwrite the (20) part. You'd need to be smarter about handling the fallback for these instances, probably maintaining some internal state.
(20) Some Text
Any progress on this? I'm willing to help out...
FWIW, I don't see any reason why their needs to be a static v dynamic distinction at all.
The fact that updateTitle doesn't take the current title into account feels like a bug and can be fixed without worrying about backwards compatibility (IMHO) in a major release.
I'd be willing to submit a new PR for that logic if there is interest ..
Agree with @simong, whilst this would be a great improvement - there shouldn't need to be a distinction and the lib should just be able to handle this situation.
#19 - bugfix for handling dynamic document titles
I've submitted a PR at #57 which addresses the issue directly.
Closed by @simong in 9cc67d6, this implementation was preferred as it requires no extra work on behalf of the user.