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

Custom element fix #2221

Merged
merged 2 commits into from Sep 20, 2018

Conversation

Projects
None yet
3 participants
@isiahmeadows
Copy link
Collaborator

isiahmeadows commented Sep 1, 2018

Description

Align custom elements to work just like normal elements, minus our HTML workarounds. Previously, our support has been undocumented and completely untested, but I plan to fix that in a follow-up commit (along with a changelog entry).

Drive-by: add a spy.calls property to ospec that helped me develop the patch. It's technically unnecessary, but it helped me clean up the tests some, and it made the tests a little more concise.

Motivation and Context

Fixes #2220

How Has This Been Tested?

Ran the tests in ospec + Node. Performance changes are within the margin of error, although I made a few size-related optimizations that incidentally reclaimed 33 bytes.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation change

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated docs/change-log.md
@isiahmeadows

This comment has been minimized.

Copy link
Collaborator

isiahmeadows commented Sep 14, 2018

@MithrilJS/collaborators Can I get a review for this real quick?


o.only("when vnode is customElement with property, custom setAttribute not called", function(){

This comment has been minimized.

@StephanHoyer

StephanHoyer Sep 17, 2018

Member

kick only

This comment has been minimized.

@isiahmeadows

isiahmeadows Sep 18, 2018

Collaborator

Ooops... 😄

This comment has been minimized.

@isiahmeadows

isiahmeadows Sep 18, 2018

Collaborator

Fixed

@StephanHoyer

This comment has been minimized.

Copy link
Member

StephanHoyer commented Sep 17, 2018

just took a brief look. Seems plausible. Will try to take a closer look in about 8h or so.

May already remove the only :D

@isiahmeadows

This comment has been minimized.

Copy link
Collaborator

isiahmeadows commented Sep 19, 2018

@StephanHoyer Was that the only issue with it? (I've removed the offending call.)

@isiahmeadows isiahmeadows force-pushed the isiahmeadows:custom-element-fix branch 2 times, most recently from 3f5ec61 to 03320e0 Sep 19, 2018

@isiahmeadows

This comment has been minimized.

Copy link
Collaborator

isiahmeadows commented Sep 19, 2018

Apologies for the Git mess here...I plan to squash this all. Edit: Not necessary.

@isiahmeadows isiahmeadows force-pushed the isiahmeadows:custom-element-fix branch 5 times, most recently from 7e00cb1 to 89fcb34 Sep 19, 2018

@isiahmeadows

This comment has been minimized.

Copy link
Collaborator

isiahmeadows commented Sep 19, 2018

I fixed the Git mess on my end - the history should be a lot cleaner and less polluted now.

@isiahmeadows isiahmeadows force-pushed the isiahmeadows:custom-element-fix branch from 89fcb34 to 3f14762 Sep 19, 2018

isiahmeadows added some commits Sep 1, 2018

Add functionality for inspecting arbitrary past calls
This made it much easier to debug multiple calls while developing this
patch.
Fix custom elements attribute application, improve key checking
- Fix custom elements attribute application to acknowledge that not all
  custom elements operate purely based on attributes. (Plus, those
  blasted things are verbose as heck when you're working with them in
  raw form. It's also not that uncommon for functionality to be exposed
  via property and *not* attribute.)
- Don't memoize the normalized value when we 1. only use it once in each
  branch, and 2. only use it for a few special cases.
- Centralize the "has property key" code, so it's easier to tune and
  read. I also inlined a couple functions while I was at it since they
  were small and only used once.
- Actually test for how attributes are applied to raw DOM elements vs
  when we choose to use keys. When I first developed the patch, it
  silently worked, when I should've been breaking things.
@StephanHoyer

This comment has been minimized.

Copy link
Member

StephanHoyer commented Sep 20, 2018

lgtm.

Sorry for the spam here. I created a flems to test this but the url was too long to share here.

@porsager is there an easy way to share large flems?

I finally got it working with ionicons.

@porsager

This comment has been minimized.

Copy link
Contributor

porsager commented Sep 20, 2018

Unfortunately the best way currently is in gists :P

@isiahmeadows isiahmeadows merged commit 1ecc30a into MithrilJS:next Sep 20, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@isiahmeadows isiahmeadows deleted the isiahmeadows:custom-element-fix branch Sep 20, 2018

@isiahmeadows

This comment has been minimized.

Copy link
Collaborator

isiahmeadows commented Sep 20, 2018

@StephanHoyer Worst case scenario, you can always hide long stuff with a <details>. GH issues do in fact support it, and I've used it before to hide things to "archive" them if I redo a lengthy, detailed proposal in a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment