# US 2015/0178254 A1 · Efficient Event Delegation In Browser Scripts

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2015/0178254 A1
- Document ID: US20150178254A1
- Status: Published application
- Kind: A1
- Application number: 14/636,390
- Filed: 2015-03-03
- Published: 2015-06-25
- Earliest claimed: 2010-09-10
- Assignees: Facebook, Inc.
- Applicants: Facebook, Inc.
- Inventors: Evan Jerome Priestley; Ashwin Ravindra Bharambe
- Web page: https://patentgrep.com/patent/US20150178254A1

## CPC

- G06F 40/143: Markup, e.g. Standard Generalized Markup Language [SGML] or Document Type Definition [DTD]
- G06F 9/542: {Event management; Broadcasting; Multicasting; Notifications}
- G06F 16/116: {Details of conversion of file system types or formats}
- G06F 16/84: Mapping; Conversion
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Event handlers associated with markup language documents represented in a web browser are identified efficiently in response to an event. The markup language document is represented as a hierarchical structure comprising nodes and edges. Nodes are associated with node types, each node type defining how descendants of the node respond to events. The markup language document provides mappings of sets of node types to sets of handlers. In response to an event associated with a node, the types of nodes encountered in a path connecting the node with the root node are identified. Handler sets of the node types encountered in the path connecting a node with the root node are used to determine the handlers to be executed in response to the event. Data is associated with nodes to allow handler code to distinguish between nodes of the same node type.

## Claims

### Claim 1

A computer implemented method comprising:
receiving a markup language document comprising nodes associated with node types and associations between nodes;
receiving a specification comprising a mapping from sets of node types to sets of handlers, wherein each set of node types specified in the mapping is mapped to a set of handlers;
receiving a request associated with a target node of the markup language document;
determining the handler associated with the node based on a context of the node in the markup language document, the context comprising a set of nodes associated with the target node in the markup language document, the determining comprising:
identifying a set of node types for the target node and the set of nodes linked to the target node;
identifying a set of handlers mapped to the identified set of node types based on the mapping from sets of node types to sets of handlers; and
executing a handler from the identified set of handlers responsive to the request.

### Claim 2 (depends on 1)

The computer implemented method of claim 1, wherein the target node is a first target node, the set of nodes is a first set of nodes, the context is a first context, and the set of node types if a first set of node types, wherein the markup language document includes a second target node having the type of the first target node, the second target node occurring in a second context comprising a second set of nodes, the determining comprising:
identifying a second set of node types for the second set of nodes linked to the second target node;
identifying a second set of handlers mapped to the second set of node types based on the mapping; and
executing a second handler from the second set of handlers responsive to the request.

### Claim 3 (depends on 1)

The computer implemented method of claim 1, wherein the set of nodes associated with the node is determined by traversing from the node to each node of the set based on the associations between nodes specified in the markup language document.

### Claim 4 (depends on 1)

The computer implemented method of claim 1, wherein the mapping maps a pair of a set of node type and an event type with a set of handlers, wherein an event type is associated with a type of user input.

### Claim 5 (depends on 4)

The computer implemented method of claim 4, further comprising:
determining an event type corresponding to the received request associated with the target node; and
wherein the identified set of handlers maps to the identified set of node types and the event type.

### Claim 6 (depends on 1)

The computer implemented method of claim 1, wherein each set of node types of the mapping is an ordered set and the order of the identified set of node types is determined based on an order associated with the set of nodes.

### Claim 7 (depends on 6)

The computer implemented method of claim 6, wherein identifying a set of handlers mapped to the identified set of node types comprises:
selecting a matching set of node types in the mapping such that the order of the node types of the matching set matches the order of the node types of the identified set; and
selecting a set of handlers mapped to the matching set of node types.

### Claim 8 (depends on 1)

The computer implemented method of claim 1, wherein the markup language document comprises a hierarchical representation of nodes as a document object model (DOM) tree and the request is associated with one of a mouse click or a key press operation.

### Claim 9 (depends on 1)

The computer implemented method of claim 1, wherein the target node is displayed in the browser as one of a link, button, or image.

### Claim 10 (depends on 1)

The computer implemented method of claim 1, wherein a node is associated with a metadata attributes, wherein the handler executed uses the metadata attribute.

### Claim 11

A non-transitory computer-readable storage medium storing instructions for:
receiving a markup language document comprising nodes associated with node types and associations between nodes;
receiving a specification comprising a mapping from sets of node types to sets of handlers, wherein each set of node types specified in the mapping is mapped to a set of handlers;
receiving a request associated with a target node of the markup language document;
determining the handler associated with the node based on a context of the node in the markup language document, the context comprising a set of nodes associated with the target node in the markup language document, the determining comprising:
identifying a set of node types for the target node and the set of nodes linked to the target node;
identifying a set of handlers mapped to the identified set of node types based on the mapping from sets of node types to sets of handlers; and
executing a handler from the identified set of handlers responsive to the request.

### Claim 12 (depends on 11)

The non-transitory computer-readable storage medium of claim 11, wherein the set of nodes associated with the node is determined by traversing from the node to each node of the set based on the associations between nodes specified in the markup language document.

### Claim 13 (depends on 11)

The non-transitory computer-readable storage medium of claim 11, wherein the mapping maps a pair of a set of node type and an event type with a set of handlers, wherein an event type is associated with a type of user input.

### Claim 14 (depends on 11)

The non-transitory computer-readable storage medium of claim 11, wherein each set of node types of the mapping is an ordered set and the order of the identified set of node types is determined based on an order associated with the set of nodes.

### Claim 15 (depends on 11)

The non-transitory computer-readable storage medium of claim 11, wherein a node is associated with a metadata attributes, wherein the handler uses the metadata attribute.

### Claim 16

A non-transitory computer-readable storage medium containing one or more markup language documents for being rendered by a web browser application executing on a computer system, the one or more markup language documents comprising:
a structure of nodes representing elements of a markup language document and edges connecting the nodes, wherein a subset of nodes is mapped to node types;
a specification comprising a mapping from sets of node types to sets of handlers, wherein each set of node types specified in the mapping is mapped to a set of handlers;
instructions to a web browser application executing on a computer system for executing handlers in response to a request associated with a target node, the instructions for causing the computer system to:
determine a context of the node in the markup language document, the context comprising a set of nodes associated with the target node in the markup language document;
identify a set of node types for the target node and the set of nodes linked to the target node;
identify a set of handlers mapped to the identified set of node types based on the mapping from sets of node types to sets of handlers; and
execute a handler from the identified set of handlers responsive to the request.

### Claim 17 (depends on 16)

The non-transitory computer-readable storage medium of claim 16, wherein the set of nodes associated with the node is determined by traversing from the node to each node of the set based on the associations between nodes specified in the markup language document.

### Claim 18 (depends on 16)

The non-transitory computer-readable storage medium of claim 16, wherein the mapping maps a pair of a set of node type and an event type with a set of handlers, wherein an event type is associated with a type of user input.

### Claim 19 (depends on 16)

The non-transitory computer-readable storage medium of claim 16, wherein each set of node types of the mapping is an ordered set and the order of the identified set of node types is determined based on an order associated with the set of nodes.

### Claim 20 (depends on 16)

The non-transitory computer-readable storage medium of claim 16, wherein a node is associated with a metadata attributes, wherein the handler executed uses the metadata attribute.
