Skip to content

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