Skip to content

Commit

Permalink
Fix error with demo tags on generated documentation
Browse files Browse the repository at this point in the history
Why?
The previous release of documentjs upgrade to can-control@3.x but
it did not account for the fact that the DemoFrame control was
instantiated with a jquery element which is no longer natively supported
in 3.x; this cause can-event to try to call addEventListener on a
jquery object which threw an error.

This is fixed by:
Make sure the control is instatiated with an HtmlElement instead of
a jquery-wrapped element.

Closes #287
  • Loading branch information
m-mujica committed Jan 9, 2019
1 parent f98e485 commit 2411f29
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
3 changes: 0 additions & 3 deletions lib/generators/html/write/filename.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
module.exports = function(docObject, configuration){
var name = typeof docObject == "string" ? docObject : docObject.name;

if(!name) {
debugger;
}
return configuration && name === configuration.parent ?
'index.html' :
name.replace(/ /g, "_")
Expand Down
6 changes: 2 additions & 4 deletions site/default/static/frame_helper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var CanControl = require("can-control");
var $ = require("jquery");
var CanControl = require("can-control");
var DemoFrame = require("./demo_frame");

module.exports = CanControl.extend({
Expand All @@ -26,9 +26,7 @@ module.exports = CanControl.extend({
// @demo can/control/control.html 400
// <div class="demo_wrapper" data-demo-src="can/control/control.html"></div>
$('.demo_wrapper', this.$element).each(function() {
var wrapper = $(this);
new DemoFrame(wrapper);

new DemoFrame(this);
});
}
});
1 change: 1 addition & 0 deletions site/default/static/static.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var $ = require("jquery");
var ContentList = require("./content_list");
var FrameHelper = require("./frame_helper");
var Versions = require("./versions");
Expand Down

0 comments on commit 2411f29

Please sign in to comment.