Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Consider parsing CSS for touch-action #69

Closed
RByers opened this issue Jun 4, 2013 · 3 comments
Closed

Consider parsing CSS for touch-action #69

RByers opened this issue Jun 4, 2013 · 3 comments

Comments

@RByers
Copy link

RByers commented Jun 4, 2013

Since polyfilling CSS is hard, we look for touch-action as an HTML attribute instead of a CSS property. This is probably the right trade-off in most cases (until browsers have native support for at least parsing the touch-action CSS property).

But perhaps we should consider having an option (not included in the build by default?) to make a best effort at parsing from CSS like other CSS polyfills (eg. using http://www.glazman.org/JSCSSP/), just to have the ability to be maximally spec compliant.

@dfreedm
Copy link
Contributor

dfreedm commented Jun 25, 2013

I'm not confident that the complexity required to parse CSS will be worth the payoff, particularly if trying to capture any dynamism.
Currently, I emit a stylesheet that will match the touch-action attribute usage to the spec property values like so:

[touch-action="none"] {
  touch-action: none;
  -ms-touch-action: none;
}

This seems to have the most bang for my buck. As for JSCSSP in particular, it's almost 3x the size of PointerEvents, and requires me to feed it stylesheet's i've XHR'd, which may have CORS issues and other nasties.

@dfreedm dfreedm closed this as completed Jun 25, 2013
@RByers
Copy link
Author

RByers commented Jun 25, 2013

Yeah, understood.
Another option to consider - CSS variables are designed to be useful for CSS polyfills (with 'var-' as sort of an author prefix) - see http://dev.w3.org/csswg/css-variables/#using. Supporting a 'var-touch-action' CSS property on browsers that support CSS variables could be valuable - eg. to allow a site to control the touch action of an entire class of elements at the same time (see this recent thread for discussion on why CSS was chosen over HTML attributes: http://lists.w3.org/Archives/Public/public-pointer-events/2013AprJun/0201.html)

@dfreedm
Copy link
Contributor

dfreedm commented Jun 25, 2013

That's a good idea, but I'm not aware of many browsers having variable support, or of any browsers supporting the CSSOM JS variable interface: http://dev.w3.org/csswg/css-variables/#the-CSSVariablesMap-interface.

There's no other way to access variables except via style attribute, but then I'm back to attribute watching again.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants