day8 / re-com

A ClojureScript library of reusable components for Reagent
https://re-com.day8.com.au
MIT License
798 stars 147 forks source link

Validation fails when attempting to register a capture phase event handler #79

Closed alanlcode closed 8 years ago

alanlcode commented 8 years ago

Version: 0.7.1-alpha1 Commit: d7915d1657eb72128c724e94d49d944c605caee6

Erroneous Behavior: Validation fails when attempting to register a capture phase event handler on any re-com component.

To reproduce:

Create a component with capture phase handler.

[h-box
:attr {:on-click-capture #()}
:children []]

The console output:

Validation failed for argument ':attr' in component 'h-box': Unknown HTML attribute(s): (:on-click-capture) ...

From the React Documentation at https://facebook.github.io/react/docs/events.html#supported-events:

To register an event handler for the capture phase, append Capture to the event name; for example, instead of using onClick, you would use onClickCapture to handle the click event in the capture phase.

Proposed Solution:

Add a -capture variant of every event handler to re-com.validate/html-attrs.

Gregg8 commented 8 years ago

Merged #80. Thanks :-)