Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught InvalidCharacterError: Failed to execute 'add' on 'DOMTokenList': The token provided ('f... #148

Closed
nadeemja opened this issue Jul 3, 2016 · 22 comments

Comments

@nadeemja
Copy link

nadeemja commented Jul 3, 2016

[Enter steps to reproduce below:]

  1. apm update 0.4 to 1.0
  2. reload atom

Atom Version: 1.8.0
System: Mac OS X 10.11.5
Thrown From: tool-bar package, v1.0.0

Stack Trace

Uncaught InvalidCharacterError: Failed to execute 'add' on 'DOMTokenList': The token provided ('fa-columns fa-rotate-270') contains HTML space characters, which are not valid in tokens.

At /Users/Nadeem/.atom/packages/tool-bar/lib/tool-bar-button-view.js:36

Error: Failed to execute 'add' on 'DOMTokenList': The token provided ('fa-columns fa-rotate-270') contains HTML space characters, which are not valid in tokens.
    at Error (native)
    at new ToolBarButtonView (/Users/Nadeem/.atom/packages/tool-bar/lib/tool-bar-button-view.js:36:31)
    at ToolBarManager.addButton (/Users/Nadeem/.atom/packages/tool-bar/lib/tool-bar-manager.js:14:20)
    at Object.utils.addButton (/Users/Nadeem/.atom/packages/tool-bar-almighty/lib/utils.coffee:17:11)
    at Object.utils.parseEntry (/Users/Nadeem/.atom/packages/tool-bar-almighty/lib/utils.coffee:29:13)
    at Object.toolBarAlmighty.consumeToolBar (/Users/Nadeem/.atom/packages/tool-bar-almighty/lib/tool-bar-almighty.coffee:34:11)
    at Provider.module.exports.Provider.provide (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/service-hub/lib/provider.js:30:52)
    at /Applications/Atom.app/Contents/Resources/app.asar/node_modules/service-hub/lib/service-hub.js:55:26
    at doNTCallback0 (node.js:443:9)
    at process._tickCallback (node.js:372:13)

Commands

Config

{
  "core": {
    "disabledPackages": [
      "spell-check",
      "archive-view",
      "linter-jscs",
      "atom-ternjs",
      "docblockr",
      "autocomplete-html",
      "linter-codeclimate",
      "emmet-snippets-compatibility",
      "es6-javascript",
      "react"
    ],
    "packagesWithKeymapsDisabled": [
      "atom-lupa",
      "tool-bar",
      "sync-settings",
      "atom-ternjs",
      "autocomplete-plus"
    ]
  },
  "tool-bar": {
    "position": "Left"
  }
}

Installed Packages

# User
Quick-JavaScript, v0.16.0
atom-bracket-highlight, v0.3.1
atom-chai-snippets, v0.3.0
autocomplete-modules, v1.5.2
emmet, v2.4.3
formatter, v2.12.3
formatter-jsbeautify, v1.0.2
highlight-column, v0.5.1
highlight-line, v0.11.1
language-babel, v2.29.2
lebab-convert, v0.9.0
linter, v1.11.14
linter-eslint, v7.2.4
meteor-api, v2.20.0
opened-files, v0.3.6
react-snippets, v0.4.2
sync-settings, v0.7.2
tool-bar, v1.0.0
tool-bar-almighty, v0.6.1
underscorejs-snippets, v0.2.2

# Dev
No dev packages
@jerone
Copy link
Contributor

jerone commented Jul 3, 2016

The tool-bar-almighty package isn't officially switched to the new service provider, but I'm still interested why this fails.

Is tool-bar-almighty the only Tool Bar plugin adding buttons to the tool-bar ?
Do you use custom entries for tool-bar-almighty ?

@jerone
Copy link
Contributor

jerone commented Jul 3, 2016

Ah found the issue; this is a bug in tool-bar-almighty ... it's not allowed to use multiple icons as value: https://github.com/varemenos/atom-toolbar-almighty/blob/master/lib/entries.coffee#L60

@nadeemja
Copy link
Author

nadeemja commented Jul 3, 2016

I sincerely appreciate your efforts.

Could you kindly outline what steps I would need to take on my part to remedy?

Could I downgrade to previous version?

@jerone
Copy link
Contributor

jerone commented Jul 3, 2016

Aldo I probably get why the author of the package added the extra class on the icon property, this is actual incorrect use of the API and it being broken now is fully understanding.

What needs to happen is that this issue needs to be reported at the package repo (and referenced back to here) so it can be solved. Removing the second class from the icon property should solve the issue. You can quote me if you want.

@nadeemja
Copy link
Author

nadeemja commented Jul 3, 2016

Cool. I'll find some time and follow your directions.

Could you please also advise on a short term / immediate solution?

Thanks again! :)

@jerone
Copy link
Contributor

jerone commented Jul 3, 2016

Could you please also advise on a short term / immediate solution?

I'm not an user of the tool-bar-almighty package, but have a look at Flex Tool Bar package.

@thiagolucio
Copy link

Same with me. I use another package...is toolbar-iconshortcuts

shell = require 'shell'

module.exports =
activate: (state) ->

deactivate: ->
@ToolBar?.removeItems()

serialize: ->

consumeToolBar: (toolBar) ->
@ToolBar = toolBar 'toolbar-iconshortcuts'

@toolBar.addButton
  icon: 'file-code-o'
  callback: 'application:new-file'
  tooltip: 'New File'
  iconset: 'fa'

@toolBar.addButton
  icon: 'file-directory'
  callback: 'application:open-file'
  tooltip: 'Open File...'
  iconset: ''

@toolBar.addButton
  icon: 'file-submodule'
  callback: 'application:open-folder'
  tooltip: 'Open Folder...'
  iconset: ''

@toolBar.addButton
  icon: 'floppy-o'
  callback: 'core:save'
  tooltip: 'Save...'
  iconset: 'fa'

@toolBar.addSpacer()

@toolBar.addButton
  icon: 'browser'
  callback: 'open-in-browser:open'
  tooltip: 'Open in Browser...'
  iconset: ''

@toolBar.addButton
  icon: 'fa fa-server'
  callback: 'atom-live-server:start-3000'
  tooltip: 'Run localhost port 3000...'
  iconset: 'fa'

@toolBar.addButton
  icon: 'markdown'
  callback: 'markdown-preview:toggle'
  tooltip: 'Markdown Preview'
  iconset: ''

@toolBar.addButton
  icon: 'chevron-right'
  callback: 'pane:split-right'
  tooltip: 'Split Right'
  iconset: ''

@toolBar.addButton
  icon: 'mirror'
  callback: 'tree-view:toggle'
  tooltip: 'Toggle Treeview'
  iconset: ''

@toolBar.addButton
  icon: 'magnifying-glass'
  callback: 'find-and-replace:show'
  tooltip: 'Find...'
  iconset: 'fi'

@toolBar.addButton
  icon: 'shuffle'
  callback: 'find-and-replace:show-replace'
  tooltip: 'Find and Replace...'
  iconset: 'ion'

@toolBar.addSpacer()

@toolBar.addButton
  icon: 'navicon-round'
  callback: 'command-palette:toggle'
  tooltip: 'Command Palette...'
  iconset: 'ion'

@toolBar.addButton
  icon: 'tools'
  callback: 'settings-view:open'
  tooltip: 'Settings...'
  #iconset: 'fi'

@toolBar.addButton
  icon: 'refresh'
  callback: 'window:reload'
  tooltip: 'Reload Window'
  iconset: 'ion'

@toolBar.addButton
  icon: 'terminal'
  callback: ->
    require('remote').getCurrentWindow().toggleDevTools()
  tooltip: 'Toggle Developer Tools'
  iconset: ''

@toolBar.addSpacer()

@toolBar.addButton
  icon: 'x'
  callback: 'tool-bar:toggle'
  tooltip: 'Close Tool-Bar'
  iconset: ''

@nadeemja
Copy link
Author

nadeemja commented Jul 4, 2016

@jerone

Thanks for your advice.

I ended up modifying my local copy of tool-bar-almighty in the atom packages folder.

Just removed that entire button with double class. Wasn't using it anyways :)

I really appreciate your help!

@jerone
Copy link
Contributor

jerone commented Jul 4, 2016

Same with me. I use another package...is toolbar-iconshortcuts

@thiagolucio This is exactly the same issue with double icons added icon: 'fa fa-server'. Please create an issue for incorrect API use at toolbar-iconshortcuts repo and reference back here. Thanks.

@jerone jerone added the wontfix label Jul 4, 2016
@jerone
Copy link
Contributor

jerone commented Jul 4, 2016

I ended up modifying my local copy of tool-bar-almighty in the atom packages folder.

@nadeemja Great that you solved it! It would still be nice if you make an issue at the plugins repo so others can benefit from your fix. Thanks.

@jerone
Copy link
Contributor

jerone commented Jul 4, 2016

Reopened for further incompatible packages.

@jerone jerone reopened this Jul 4, 2016
@thiagolucio
Copy link

thiagolucio commented Jul 4, 2016

Thanks Jerone.
I make the changes you suggest and after change all works fine!
I decide change all icons declarations to default repository icons (octicons) for better code to.
I update the package toolbar-iconshortcuts (because this package is mine).
Now the configuration script is that...Solved!

shell = require 'shell'

module.exports =
  activate: (state) ->

  deactivate: ->
    @toolBar?.removeItems()

  serialize: ->

  consumeToolBar: (toolBar) ->
    @toolBar = toolBar 'toolbar-iconshortcuts'

    @toolBar.addButton
      icon: 'file-code'
      callback: 'application:new-file'
      tooltip: 'New File'
      iconset: ''

    @toolBar.addButton
      icon: 'file-directory'
      callback: 'application:open-file'
      tooltip: 'Open File...'
      iconset: ''

    @toolBar.addButton
      icon: 'file-submodule'
      callback: 'application:open-folder'
      tooltip: 'Open Folder...'
      iconset: ''

    @toolBar.addButton
      icon: 'checklist'
      callback: 'core:save'
      tooltip: 'Save...'
      iconset: ''

    @toolBar.addSpacer()

    @toolBar.addButton
      icon: 'browser'
      callback: 'open-in-browser:open'
      tooltip: 'Open in Browser...'
      iconset: ''

    @toolBar.addButton
      icon: 'server'
      callback: 'atom-live-server:start-3000'
      tooltip: 'Run localhost port 3000...'
      iconset: ''

    @toolBar.addButton
      icon: 'markdown'
      callback: 'markdown-preview:toggle'
      tooltip: 'Markdown Preview'
      iconset: ''

    @toolBar.addButton
      icon: 'chevron-right'
      callback: 'pane:split-right'
      tooltip: 'Split Right'
      iconset: ''

    @toolBar.addButton
      icon: 'mirror'
      callback: 'tree-view:toggle'
      tooltip: 'Toggle Treeview'
      iconset: ''

    @toolBar.addButton
      icon: 'search'
      callback: 'find-and-replace:show'
      tooltip: 'Find...'
      iconset: ''

    @toolBar.addButton
      icon: 'diff'
      callback: 'find-and-replace:show-replace'
      tooltip: 'Find and Replace...'
      iconset: ''

    @toolBar.addSpacer()

    @toolBar.addButton
      icon: 'three-bars'
      callback: 'command-palette:toggle'
      tooltip: 'Command Palette...'
      iconset: ''

    @toolBar.addButton
      icon: 'settings'
      callback: 'settings-view:open'
      tooltip: 'Settings...'
      #iconset: ''

    @toolBar.addButton
      icon: 'sync'
      callback: 'window:reload'
      tooltip: 'Reload Window'
      iconset: ''

    @toolBar.addButton
      icon: 'terminal'
      callback: ->
        require('remote').getCurrentWindow().toggleDevTools()
      tooltip: 'Toggle Developer Tools'
      iconset: ''

    @toolBar.addSpacer()

    @toolBar.addButton
      icon: 'x'
      callback: 'tool-bar:toggle'
      tooltip: 'Close Tool-Bar'
      iconset: ''

@Cherkah
Copy link

Cherkah commented Jul 4, 2016

hi, mee too i got one:

`[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.8.0
System: Unknown Windows Version
Thrown From: tool-bar package, v1.0.0

Stack Trace

Uncaught InvalidCharacterError: Failed to execute 'add' on 'DOMTokenList': The token provided ('fa-columns fa-rotate-270') contains HTML space characters, which are not valid in tokens.

At /C:/Users/abdul/.atom/packages/tool-bar/lib/tool-bar-button-view.js:45

Error: Failed to execute 'add' on 'DOMTokenList': The token provided ('fa-columns fa-rotate-270') contains HTML space characters, which are not valid in tokens.
    at Error (native)
    at new ToolBarButtonView (C:/Users/abdul/.atom/packages/tool-bar/lib/tool-bar-button-view.js:36:31)
    at ToolBarManager.addButton (C:/Users/abdul/.atom/packages/tool-bar/lib/tool-bar-manager.js:14:20)
    at Object.module.exports.consumeToolBar (file:///C:/Users/abdul/.atom/packages/tool-bar-shortcuts/lib/tool-bar-shortcuts.coffee:164:22)
    at Provider.module.exports.Provider.provide (C:\Users\abdul\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\service-hub\lib\provider.js:30:52)
    at C:\Users\abdul\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\service-hub\lib\service-hub.js:55:26
    at doNTCallback0 (node.js:443:9)
    at process._tickCallback (node.js:372:13)

Commands

Config

{
  "core": {
    "automaticallyUpdate": false,
    "disabledPackages": [
      "language-powershell",
      "autohide-tree-view",
      "latex",
      "tool-bar-atom",
      "tool-bar-almighty",
      "markdown-preview",
      "markdown-pdf"
    ],
    "excludeVcsIgnoredPaths": false,
    "themes": [
      "one-light-ui",
      "atom-dark-syntax"
    ]
  },
  "tool-bar": {
    "iconSize": "16px"
  }
}

Installed Packages

# User
autocomplete-python, v1.8.1
file-icons, v1.7.15
language-latex, v0.6.1
language-pfm, v0.82.0
linter, v1.11.14
markdown-preview-plus, v2.4.0
markdown-scroll-sync, v2.1.2
minimap, v4.24.6
open-recent, v5.0.0
preview-inline, v1.0.5
tidy-markdown, v3.0.1
tool-bar, v1.0.0
tool-bar-shortcuts, v0.1.5

# Dev
No dev packages

`
please how can i remove it?

@Cherkah
Copy link

Cherkah commented Jul 4, 2016

I ended up modifying my local copy of tool-bar-almighty in the atom packages folder.
Just removed that entire button with double class. Wasn't using it anyways

@nadeemja
please can you give details on how to proceed to "modify local copy" of a tool-bar-plugin?
what am i to remove? (sorry for my newbee request...)

thanks

@nadeemja
Copy link
Author

nadeemja commented Jul 4, 2016

@Cherkah

Here's what I did.

  1. Open Atom Editor.
  2. Open Settings
  3. Click Open Config Folder
  4. Open file entries.coffee in .atom/packages/tool-bar-almighty/lib/ folder.
  5. Remove lines 56-62, or remove fa-rotate-270 from line 60.

This is what worked for me.
Hope it works for you too.

@Cherkah
Copy link

Cherkah commented Jul 4, 2016

@nadeemja
thanks for your efficient set.
problem solve for tool-bar_almighty!

i would like to know how to proceed for modules like tool-bar-shorcuts and tool-bar-atom which they do not have entires.coffee files in their /lib directory?
in my case, they have only one file, respectively tool-bar-shorcuts.coffee and tool-bar-atom.coffee

edit:
ok i answer to myself
just do the same thing on the tool-bar-shorcuts.coffee or tool-bar-atom.coffee (Remove fa-rotate-270) and the problem goes out.

@jeselxe
Copy link

jeselxe commented Jul 6, 2016

I've submitted a PR that I think solves the problem. As It allows to add multiple classes to a button.
To make it work, the toolbars have to change fa-rotate-270 to rotate-270, because gets the prefix from the iconset.

@jerone
Copy link
Contributor

jerone commented Jul 11, 2016

Closing this issue as it looks like all affected plugins have been notified or fixed.

@jerone jerone closed this as completed Jul 11, 2016
pierrechevalier83 added a commit to pierrechevalier83/tokamak that referenced this issue Jul 20, 2016
When starting atom, an exception was thrown in tool-bar-button-view.js.
The root cause is that the format of this config file doesn't satisfy the current tool-bar API.

For a complete explanation, please read this issue that was raised against tool-bar:
atom-community/tool-bar#148 (comment)
@gni
Copy link

gni commented Jul 22, 2016

Hey. I got this error several weeks before on my debian.
Today i'm workin on another distrib and still got the same error.
For me it's tool-bar-almighty who generate this error.
I fixed it on .atom/packages/tool-bar-almighty/entries.coffee
icon: 'columns fa-rotate-270'
with
icon: 'fa-rotate-270'

Regards

@jerone
Copy link
Contributor

jerone commented Jul 22, 2016

@4p The issue has been reported here: varemenos/atom-toolbar-almighty#17

@gni
Copy link

gni commented Jul 22, 2016

Thanks. I dunno why atom give me this link for the issue.

@jerone
Copy link
Contributor

jerone commented Jul 22, 2016

Because atom-toolbar-almighty is using Tool Bar service with an "invalid" API, throwing an error within the Tool Bar package. People have to actually read the error to find the source package, or I help them in the right direction :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants