superframe icon indicating copy to clipboard operation
superframe copied to clipboard

Support for hyphenated component names

Open diarmidmackenzie opened this issue 4 years ago • 2 comments

A candidate fix for: https://github.com/supermedium/superframe/issues/296

Not sure if you'll like this solution, as it's pragmatic rather than being 100% robust...

Other solutions I considered:

  • Duplicating the entire styleParser code out of A-Frame utils into event-set, except for the camel casing. That seemed unwieldy.
  • Changing the A-Frame utils API to either export the styleParse function or have an optional parameter on styleParse.parse to control whether or not camel casing happened. I was hoping for a fix that was contained within this repo, rather than having dependencies on another repo, with all the version issues that would ensue...

So having ruled out those two approaches, I ended up using A-Frame utils styleParser.parse, and then patching up the results as best I could.

As per the comments in the index.js file, that's not a 100% robust solution, but much better than the current implemetation. The problematic cases are all fairly pathological...

diarmidmackenzie avatar Nov 19 '21 19:11 diarmidmackenzie

@dmarcos - Any comments on this?

diarmidmackenzie avatar Jan 08 '22 20:01 diarmidmackenzie

Maybe the better solution will be fix this on aframe changing the AFRAME.utils.styleParser.stringify() to return with dash. So, with this, the aframe-event-set-component could to use stringify on props to return. The parser transforms to camel case and stringify dosn't come back to kebab case is a strange behavior.

isaac-pj avatar May 06 '23 23:05 isaac-pj