Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functions to manage math items within a given container. (#351) #502

Merged
merged 4 commits into from
Jun 16, 2020

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented May 27, 2020

This PR adds API calls to allow managing of math items with container elements in the DOM. For example, if you are updating a portion of the DOM (by setting its innerHTML for example) and typeset math is removed, you want to be able to remove the associated MathItems from the list of MathItems held in the MathDocument. Previously there was no API for that.

There two new main calls added to the base MathDocument class: clearMathItemsWithin() and getMathItemsWithin(). Both take a container element; the first removes the MathItems from the MathList that are found within the container, and the second returns an array of MathItems found within the container.

There is also a new LinkedList method, remove() for removing an item from the list.

Finally, there is a new DOMAdaptor method (contains()) to determine if an element is contained in another element.

This PR also fixes a bug in the liteAdaptor's replace() call where the parent elements weren't being set for the new nodes being inserted into the LiteDOM.

Resolves issue #351.

@dpvc dpvc requested a review from zorkow May 27, 2020 20:33
@dpvc dpvc added this to the v3.1.0 milestone May 29, 2020
dpvc added 2 commits May 29, 2020 15:02
…lections of containers, and with CSS selectors
…lude the clear and get functions in the MathDocument interface.
Copy link
Member

@zorkow zorkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor issues. O/w lgtm.

ts/core/DOMAdaptor.ts Outdated Show resolved Hide resolved
ts/core/MathDocument.ts Outdated Show resolved Hide resolved
@dpvc dpvc merged commit 48509e1 into develop Jun 16, 2020
@dpvc dpvc deleted the container-api branch June 16, 2020 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants