HeapsIO / domkit

CSS Components based strictly typed UI framework for Haxe
MIT License
84 stars 20 forks source link

domkit css parsing support broken in javascript #48

Closed bh213 closed 1 year ago

bh213 commented 1 year ago

When using latest heaps and domkit, hashlink version works correctly while javascript css file parsing produces no rules.

I believe this was caused by 21c751aade59a0901a79de30a6c388773c41df49 and I think that the issue is in this line as all classes are recognized as erased.

https://github.com/HeapsIO/domkit/blob/09be92459f37b108621177520c134e89a1a994bc/domkit/CssParser.hx#L358

Didn't debug too deep so details might be wrong. Example:

This works: https://github.com/bh213/heaps-domkit-sample

and this one does not (js only, hl works for both): https://github.com/bh213/heaps-domkit-sample/commit/ce416aadc313c0db839773262ddb696299716d19

ncannasse commented 1 year ago

Thanks for reporting. Does changing Identifier.isDefined() to this != #if hl 0 #else null #end; work ?

bh213 commented 1 year ago

I tried and it didn't solve the issue. If I removed the whole block (below) then at least some css got applied through I got a lot of invalid css errors. Before it is like there is no css content at all (js, hashlink is completely fine)

for( c in classes.copy() )
  if( c.className == ERASED ) {
      classes.remove(c);
      if( classes.length == 0 )
          rules.pop();
bh213 commented 1 year ago

This is the issue, isDefined didn't even get called. Your change probably still needs to be applied though: https://github.com/HeapsIO/domkit/blob/09be92459f37b108621177520c134e89a1a994bc/domkit/Identifier.hx#L6