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

fix #6864: don't set ignoredElements' attributes to their default values #6885

Closed
wants to merge 4 commits into from

Conversation

imyzf
Copy link
Contributor

@imyzf imyzf commented Oct 23, 2017

Fix #6864

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

@yyx990803
Copy link
Member

Thanks for the PR. A few issues:

  1. In 2.5 ignoredElements also support regular expressions.
  2. Placing this check in setAttr can be too expensive. Ideally we don't want to affect performance of the entire framework for such a niche use case.

@imyzf
Copy link
Contributor Author

imyzf commented Oct 24, 2017

@yyx990803 Thanks for your suggestions. I have a new idea:

  1. Add a flag isIgnoredElement to VNode
  2. Judge and set isIgnoredElement in createElm
  3. In setAttr, strip the default attribution process if isIgnoredElement is true

Would this be better?

@imyzf imyzf changed the title fix #6864: don't set ignoredElements' attributes to their default values fix #6864: don't set ignoredElements' attributes to their default values [WIP] Oct 28, 2017
@imyzf imyzf changed the title fix #6864: don't set ignoredElements' attributes to their default values [WIP] fix #6864: don't set ignoredElements' attributes to their default values Oct 30, 2017
@yyx990803 yyx990803 closed this in 50b711a Mar 7, 2018
@yyx990803
Copy link
Member

Thanks a lot for the PR. After re-consideration, I think the easier way to deal with this is simply checking if the element could be a custom one when setting the attribute. This avoids the overhead of adding flags to the vnode.

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.

Overwrite of element attributes with default value
2 participants