DOM Element to Source Code Linking via Node Tree Mapping

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Developers face difficulty in locating and modifying the source code associated with specific modifications in a web page, as the corresponding markup text is not immediately obvious and may originate from unfamiliar code, making it hard to permanently apply changes to a running page.

Innovation Solution

A method is introduced that constructs a document node tree with text offsets, linking DOM elements to the corresponding text in the source document, allowing for a dynamic representation of the DOM that maps view node trees to document node trees, enabling instant matching of DOM elements with their source code definitions.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of operation

If developers dynamically modify DOM elements to see changes reflected immediately, then the ability to test modifications in real-time is improved, but the difficulty of locating the source code text associated with the desired modification increases

Engineering Contradiction:
Improveability to test modificationsVSAvoiddifficulty of locating source code
Core Design Contradiction:
Ease of operationVSDifficulty of detecting and measuring

Solution Approach 1:

The patent introduces an intermediary mapping system that connects DOM elements to their source code locations. When a developer selects a DOM element in the running page, the system acts as a mediator to automatically locate and highlight the corresponding source code text, eliminating the need for developers to manually search through code files.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The system provides immediate feedback by establishing a bidirectional link between the running page and source code. When developers modify source code, the changes are reflected in the running page, and conversely, when developers select DOM elements in the running page, the system feedbacks the location of the corresponding source code text, creating a closed-loop development experience.

Inventive Principle:
Principle #23Feedback

2Reliability

If the markup text source document is modified to permanently apply changes, then the persistence of modifications is improved, but the time required to locate and modify the associated markup text increases

Engineering Contradiction:
Improvepersistence of changesVSAvoidtime to locate and modify source code
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The system performs preliminary action by pre-establishing the mapping between DOM elements and source code locations before the developer needs to make modifications. The mapping infrastructure is built in advance, so when a developer wants to permanently apply changes, the source code location is already identified and ready for editing, eliminating the time-consuming search process.

Inventive Principle:
Principle #10Preliminary action

3Adaptability or versatility

If the source code is complex or unfamiliar to the developer, then the versatility of the system is improved, but the ease of locating and modifying the desired code decreases

Engineering Contradiction:
Improvehandling of complex codeVSAvoidease of modifying source code
Core Design Contradiction:
Adaptability or versatilityVSEase of operation

Solution Approach 1:

The system provides self-service by automatically handling the complex task of locating source code without requiring developer expertise in code navigation. The mapping system independently tracks the relationship between DOM elements and source code, allowing developers to work with complex or unfamiliar codebases without needing to understand the internal code structure or navigation paths.

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS10540416B2Linking source code to running element
Publication Date: 2020.01.21 MICROSOFT TECHNOLOGY LICENSING LLC
  • US10540416B2 patent drawing
  • US10540416B2 patent drawing
  • US10540416B2 patent drawing

AI summary

A method includes parsing a text source document to construct a document node tree such that the document node tree includes text offsets indicating the location of the text within the text source document corresponding to each node of the document node tree. The method includes constructing, from the document node tree, a Document Object Model (DOM) and a view node tree that represents the DOM. The constructing of the view node tree includes mapping the view node tree to the document node tree. The method includes providing a running representation of the DOM such that DOM elements of the DOM are linked to the text within the text source document corresponding to the DOM elements via the view node tree and the document node tree.