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

CssClassSetImpl._validateToken #106

Closed
thekekc opened this issue May 6, 2015 · 4 comments
Closed

CssClassSetImpl._validateToken #106

thekekc opened this issue May 6, 2015 · 4 comments

Comments

@thekekc
Copy link

thekekc commented May 6, 2015

I recieve this exception while running examples using dart sdk 1.10.0 and dartium 39.0.2171.0:
Exception: Uncaught Error: Invalid argument (value): Not a valid class token: ""
Stack Trace:
#0 CssClassSetImpl._validateToken (file:///Volumes/data/b/build/slave/dartium-mac-full-stable/build/src/dart/sdk/lib/html/html_common/css_class_set.dart:13)
#1 CssClassSetImpl.add (file:///Volumes/data/b/build/slave/dartium-mac-full-stable/build/src/dart/sdk/lib/html/html_common/css_class_set.dart:108)
#2 BwuDatagrid._createColumnHeaders (package:bwu_datagrid/bwu_datagrid.dart:749:21)
#3 BwuDatagrid._finishInitialization (package:bwu_datagrid/bwu_datagrid.dart:369:7)
#4 BwuDatagrid._init (package:bwu_datagrid/bwu_datagrid.dart:333:7)
#5 BwuDatagrid.setup. (package:bwu_datagrid/bwu_datagrid.dart:184:9)
#6 Future.Future. (dart:async/future.dart:118)
#7 Timer._createTimer. (dart:async-patch/timer_patch.dart:16)
#8 _Timer._Timer. (dart:html:42314)

I guess, they included css validation, and last line of code below sets empty string for a style, which is not a valid css.
var header = (new dom.Element.tag(
'bwu-datagrid-header-column') as BwuDatagridHeaderColumn)
..classes.add('ui-state-default')
..classes.add('bwu-datagrid-header-column')
..append(nameElement)
..style.width = "${m.width - _headerColumnWidthDiff}px"
//..attributes["id"] ='${uid}${m.id}'
..attributes["id"] = '${m.id}'
..attributes["title"] = m.toolTip != null ? m.toolTip : ""
..attributes['ismovable'] = '${m.isMovable}'
..column = m
..classes.add(m.headerCssClass != null ? m.headerCssClass : "");
So it should be provided explicitly a header css or last line rewritten not providing empty string as a class.
Thank you.

@thekekc
Copy link
Author

thekekc commented May 6, 2015

Actually there are some issues with classes.add method. Now it cannot get a string containing several styles or empty string. To add several classes simultaneously addAll method should be used

@zoechi
Copy link
Contributor

zoechi commented May 6, 2015

Thanks for reporting. I'll check it.

@gtaylor20
Copy link

I was having the same problem, but thanks to the hint above about classes.add, I coded a workaround. I'm still using v0.0.18, but this worked for me:

In _createColumnHeaders, instead of adding an empty string, I add an innocuous class as follows:
..classes.add(m.headerCssClass != null ? m.headerCssClass : "xx");

In _appendRowHtml, instead of adding "rowCss", I split it into a List and addAll, as follows:
List rowCssx = rowCss.split(new RegExp("\s+"));
: : : :
..classes.addAll(rowCssx)

In _appendCellHtml, instead of adding "cellCss", I split it into a List and addAll, as follows:
List cellCssx = cellCss.trim().split(new RegExp("\s+"));
: : : :
dom.HtmlElement cellElement = new dom.DivElement()..classes.addAll(cellCssx);

@zoechi zoechi mentioned this issue May 28, 2015
@zoechi
Copy link
Contributor

zoechi commented May 28, 2015

Fixed by @gonzalopezzi 👍

@zoechi zoechi closed this as completed May 28, 2015
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

3 participants