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

Support target element reference #66

Closed
yinonov opened this issue Jan 23, 2023 · 2 comments · Fixed by #70
Closed

Support target element reference #66

yinonov opened this issue Jan 23, 2023 · 2 comments · Fixed by #70

Comments

@yinonov
Copy link
Contributor

yinonov commented Jan 23, 2023

any hints on strategy for adding support to JS target element reference?
openui/open-ui#651 (comment)

@keithamus
Copy link
Collaborator

keithamus commented Jan 26, 2023

  • popoverToggleTargetElement, popoverShowTargetElement, popoverHideTargetElement will all be properties that will be exposed on HTMLElement
  • We'll need a weakmap for each that stores has the key of the element (this) and the value that it can be set to (the target element).
  • The setter function should set the weakmap to the value given
  • The getter function will need to run through some steps (reading from the spec):
    • If the el.disabled return null
    • If el.form && isSubmitButton(el) return null
    • If the WeakMap value is not falsey
      • If value's .popover value is 'auto' or 'manual' returns the value
      • Else return null
    • If the WeakMap value is empty...
      • Call getAttribute() with the respective attribute
      • If the attribute is falsey, return null
      • If the attribute is a string, call get el = document.getElementById(attr)
        • If value's .popover value is 'auto' or 'manual' returns the value
        • Else return null

yinonov pushed a commit to yinonov/popover-polyfill that referenced this issue Jan 27, 2023
@yinonov
Copy link
Contributor Author

yinonov commented Jan 27, 2023

Many thanks @keithamus. started a draft #70. will ping once I feel it's ready for review

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 a pull request may close this issue.

2 participants