Skip to content
This repository has been archived by the owner on Dec 19, 2017. It is now read-only.

NoSuchMethodError when the template in the core-list-dart does not contain an inner tag #142

Closed
fedy2 opened this issue Nov 5, 2014 · 3 comments · Fixed by #146
Closed

Comments

@fedy2
Copy link

fedy2 commented Nov 5, 2014

When I declare a core-list-dart with this template:

      <template>
        {{model.name}}
      </template>

I get this exception:

Exception: Uncaught Error: The null object does not have a setter 'hidden='.

NoSuchMethodError: method not found: 'hidden='
Receiver: null
Arguments: [false]
Stack Trace:
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#1      CoreList.updateItem (package:core_elements/core_list_dart.dart:258:18)
#2      CoreList.refresh (package:core_elements/core_list_dart.dart:317:24)
#3      CoreList.initializeItems (package:core_elements/core_list_dart.dart:245:17)
#4      CoreList.initializeData.<anonymous closure> (package:core_elements/core_list_dart.dart:227:56)
#5      _RootZone.runUnary (dart:async/zone.dart:1151)
#6      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:496)
#7      _Future._propagateToListeners (dart:async/future_impl.dart:579)
#8      _Future._completeWithValue (dart:async/future_impl.dart:339)
#9      _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:401)
#10     _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#11     _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#12     _handleMutation (dart:html:40489)

Instead I get no exception when wrapping the polymer expression with a div tag:

      <template>
        <div>{{model.name}}</div>
      </template>
@jakemac53 jakemac53 self-assigned this Nov 5, 2014
@jakemac53
Copy link
Contributor

I think this is working as intended. If you don't have a div or some other block level element then the core-list won't work (each item will just be displayed inline next to the other items). You are also responsible for setting the height on the individual items to properly match up with the height that the core-list-dart expects each item to be, otherwise the viewport won't be the right size and things like scrollTo won't work as expected.

This is all a bit unfortunate but it does allow for maximum customization. For instance we could automatically wrap each list item in a div and set the height to the core-list height property, but we wouldn't know what type of overflow is desired (hidden? scroll? ellipsis?).

@jakemac53
Copy link
Contributor

That being said we should probably at least throw a meaningful error in this case.

@fedy2
Copy link
Author

fedy2 commented Nov 5, 2014

A meaningful exception would be nice. Also a note in the documentation would be useful.

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

Successfully merging a pull request may close this issue.

2 participants