canjs / can-23

A CanJS 2.3 stache built from mostly CanJS 6 parts.
0 stars 1 forks source link

Support Firefox 108 #17

Closed morganheimbeck closed 1 year ago

morganheimbeck commented 1 year ago

Tests do not pass in latest Firefox 108 version.

Tests failing: 263 can/component dom: treecombo. Source: makeTest@http://localhost:3621/component/component_test.js:453:7 anonymous/ 264 can/component dom: deferred grid Source: makeTest@http://localhost:3621/component/component_test.js:668:7 anonymous/ 265 can/component dom: nextprev Source: makeTest@http://localhost:3621/component/component_test.js:782:7 anonymous/ 266 can/component dom: page-count Source: makeTest@http://localhost:3621/component/component_test.js:815:7 anonymous/ 267 can/component dom: hello-world and whitespace around custom elements Source: makeTest@http://localhost:3621/component/component_test.js:844:7 anonymous/ 271 can/component dom: setting passed variables - two way binding Source: makeTest@http://localhost:3621/component/component_test.js:935:7 anonymous/ 275 can/component dom: content in a list Source: makeTest@http://localhost:3621/component/component_test.js:1048:7 anonymous/ 279 can/component dom: viewModel not rebound correctly (#550) Source: makeTest@http://localhost:3621/component/component_test.js:1149:7 anonymous/ 280 can/component dom: inserted event fires twice if component inside live binding block Source: makeTest@http://localhost:3621/component/component_test.js:1205:7 anonymous/ 284 can/component dom: Component events bind to window Source: makeTest@http://localhost:3621/component/component_test.js:1365:7 anonymous/ 289 can/component dom: nested component within an #if is not live bound(#1025) test #2 Source: makeTest@http://localhost:3621/component/component_test.js:1473:7 anonymous/

Ended test on 291

Essentially the problem boils down to not specifying the Type of can.List in a new can.Map. The perfect example is: "can/component new bindings dom" "treecombo" the test fails when running all tests, but passes if you run just that test. the viewModel.selected property is initiated with [] but when the toggle method runs, this.attr('selected') is a reference to this If you change the viewModel from viewModel: {selected: []} to

const VM = can.Map.extend({
  define: {
    selected: {
      Type: can.List, 
      Value: can.List
    }
  }
}); 
...
viewModel: VM,
...

the tests for treecombo will now pass.

morganheimbeck commented 1 year ago

I think I have a solution, would love your feedback.

https://github.com/canjs/can-23/pull/18

bmomberger-bitovi commented 1 year ago

The fix works fine in Firefox and doesn't cause regressions in Chromium. I've gone ahead and merged and released it.