Commit graph

8 commits

Author SHA1 Message Date
Linus Groh
e37cf73300 LibJS: Rename OrdinaryFunctionObject to ECMAScriptFunctionObject
The old name is the result of the perhaps somewhat confusingly named
abstract operation OrdinaryFunctionCreate(), which creates an "ordinary
object" (https://tc39.es/ecma262/#ordinary-object) in contrast to an
"exotic object" (https://tc39.es/ecma262/#exotic-object).

However, the term "Ordinary Function" is not used anywhere in the spec,
instead the created object is referred to as an "ECMAScript Function
Object" (https://tc39.es/ecma262/#sec-ecmascript-function-objects), so
let's call it that.

The "ordinary" vs. "exotic" distinction is important because there are
also "Built-in Function Objects", which can be either implemented as
ordinary ECMAScript function objects, or as exotic objects (our
NativeFunction).

More work needs to be done to move a lot of infrastructure to
ECMAScriptFunctionObject in order to make FunctionObject nothing more
than an interface for objects that implement [[Call]] and optionally
[[Construct]].
2021-09-25 17:51:30 +02:00
Andreas Kling
e649144a90 LibWeb: Replace ScriptExecutionContext::interpreter() with realm()
Here goes another step towards Document not having a JS::Interpreter.
2021-09-19 15:39:40 +02:00
Andreas Kling
51b33b5678 LibWeb: Implement basic retargeting of body/frameset event handlers
The HTML spec tells has some special rules for <body> and <frameset>
elements' onfoo event handler attributes. In some cases, the implicitly
generated event listeners should end up on the relevant global object
instead of the element itself.

This patch implements the first part of that behavior.
2021-09-19 13:08:30 +02:00
Andreas Kling
824be02cb0 LibWeb: Move onfoo attribute handling to EventTarget
This logic was kept in the GlobalEventHandlers mixing for sharing
between Document and HTMLElement, but there are other interfaces who
need to support `onfoo` attribute event listeners as well.
2021-09-19 01:43:27 +02:00
Luke
2cc6b919f7 LibWeb: Implement EventTarget.dispatchEvent
Used by Web Platform Tests to test events
2021-05-04 23:41:44 +01:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Linus Groh
9d2635d94b LibWeb: Support nullable EventListener parameters in WrapperGenerator
The internal C++ function will now receive a RefPtr<EventListener> for
'EventListener?' and a NonnullRefPtr<EventListener> for 'EventListener'.

Examples of this are addEventListener() and removeEventListener(), which
both have nullable callback parameters.
2021-04-10 21:00:04 +02:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Renamed from Libraries/LibWeb/DOM/EventTarget.cpp (Browse further)