mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
LibWeb: Expose the location object via Document.location
Both Window.location and Document.location use the same instance of the Location object. Some sites use it via Window, some via Document.
This commit is contained in:
parent
ee5bac0891
commit
678dd2d180
6 changed files with 34 additions and 1 deletions
|
@ -979,4 +979,16 @@ bool Document::is_fully_active() const
|
|||
return browsing_context() && browsing_context()->active_document() == this && (browsing_context()->is_top_level() || browsing_context()->container_document()->is_fully_active());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/history.html#dom-document-location
|
||||
Bindings::LocationObject* Document::location()
|
||||
{
|
||||
// The Document object's location attribute's getter must return this Document object's relevant global object's Location object,
|
||||
// if this Document object is fully active, and null otherwise.
|
||||
|
||||
if (!is_fully_active())
|
||||
return nullptr;
|
||||
|
||||
return window().wrapper()->location_object();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue