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

reduce filesize and performance optimization #429

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

cyfung1031
Copy link

@cyfung1031 cyfung1031 commented Dec 2, 2023

reduce filesize by some code fixes

Remark 1: Reason for changing this.each ( callback ) to each ( this, callback )

Screen Shot 2023-12-02 at 18 03 56

For the code minimization, this.each( will be reduced to d(

Remark 2: changing wrapper.children.length to wrapper.firstElementChild

When calling children, it will create a new NodeList that containing all the sub-elements under the element wrapper.
As this is just to check whether there is any element child or not, firstElementChild or lastElementChild shall be used for performance consideration.

Remark 3: .insertBefore ( ele, null ); is the same as .appendChild ( ele );

@cyfung1031 cyfung1031 changed the title reduce filesize reduce filesize and performance optimization Dec 2, 2023
@cyfung1031
Copy link
Author

@fabiospampinato this can reduce filesize without change of any behavior.

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.

1 participant