Skip to content

Commit a1b30fd

Browse files
committed
Merge pull request #12 from wmhilton/develop
Bugfix: handle selectors with spaces.
2 parents 82a6b1e + 3e2c6ac commit a1b30fd

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
},
2424
"homepage": "https://github.com/xbsoftware/enjoyhint",
2525
"devDependencies": {
26-
"grunt-contrib-cssmin": "^0.11.0"
26+
"grunt-contrib-concat": "^0.5.1",
27+
"grunt-contrib-cssmin": "^0.11.0",
28+
"grunt-contrib-jshint": "^0.11.2",
29+
"grunt-contrib-uglify": "^0.9.1"
2730
},
2831
"dependencies": {
2932
"grunt": "^0.4.5",

src/enjoyhint.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,11 @@ var EnjoyHint = function (_options) {
6969
if (!step_data.selector) {
7070
for (var prop in step_data) {
7171
if (step_data.hasOwnProperty(prop) && prop.split(" ")[1]) {
72-
step_data.selector = prop.split(" ")[1];
73-
step_data.event = prop.split(" ")[0];
74-
if (prop.split(" ")[0] == 'next' || prop.split(" ")[0] == 'auto' || prop.split(" ")[0] == 'custom') {
75-
step_data.event_type = prop.split(" ")[0];
72+
var space_index = prop.indexOf(" ");
73+
step_data.event = prop.slice(0, space_index);
74+
step_data.selector = prop.slice(space_index + 1);
75+
if (step_data.event == 'next' || step_data.event == 'auto' || step_data.event == 'custom') {
76+
step_data.event_type = step_data.event;
7677
}
7778
step_data.description = step_data[prop];
7879
}

0 commit comments

Comments
 (0)