mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-27 23:55:47 +01:00
Only fire the DOMLoad autocommand for the top level document.
This matches the PageLoad autocommand behaviour.
This commit is contained in:
@@ -510,8 +510,9 @@ function Events() //{{{
|
|||||||
|
|
||||||
function onDOMContentLoaded(event)
|
function onDOMContentLoaded(event)
|
||||||
{
|
{
|
||||||
if (event.originalTarget instanceof HTMLDocument)
|
let doc = event.originalTarget;
|
||||||
triggerLoadAutocmd("DOMLoad", event.originalTarget);
|
if (doc instanceof HTMLDocument && !doc.defaultView.frameElement)
|
||||||
|
triggerLoadAutocmd("DOMLoad", doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: see what can be moved to onDOMContentLoaded()
|
// TODO: see what can be moved to onDOMContentLoaded()
|
||||||
@@ -532,9 +533,6 @@ function Events() //{{{
|
|||||||
|
|
||||||
// code which should happen for all (also background) newly loaded tabs goes here:
|
// code which should happen for all (also background) newly loaded tabs goes here:
|
||||||
|
|
||||||
let url = doc.location.href;
|
|
||||||
let title = doc.title;
|
|
||||||
|
|
||||||
// mark the buffer as loaded, we can't use buffer.loaded
|
// mark the buffer as loaded, we can't use buffer.loaded
|
||||||
// since that always refers to the current buffer, while doc can be
|
// since that always refers to the current buffer, while doc can be
|
||||||
// any buffer, even in a background tab
|
// any buffer, even in a background tab
|
||||||
@@ -555,7 +553,7 @@ function Events() //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // background tab
|
else // background tab
|
||||||
liberator.echomsg("Background tab loaded: " + title || url, 3);
|
liberator.echomsg("Background tab loaded: " + doc.title || doc.location.href, 3);
|
||||||
|
|
||||||
triggerLoadAutocmd("PageLoad", doc);
|
triggerLoadAutocmd("PageLoad", doc);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user