```
@@ -112,7 +94,7 @@ var myButton = this.getEl('myButton');
#### Using `w-on*` with a nested widget
```xml
-
+
```
diff --git a/test/autotests/widgets-server/w-bind-missing-widget/test.js b/test/autotests/widgets-server/w-bind-missing-widget/test.js
index 3c77c670f..518c13af4 100644
--- a/test/autotests/widgets-server/w-bind-missing-widget/test.js
+++ b/test/autotests/widgets-server/w-bind-missing-widget/test.js
@@ -3,5 +3,5 @@ var expect = require('chai').expect;
module.exports = function(helpers) {
expect(function() {
require('./template.marko');
- }).to.throw(/Invalid "w-bind" attribute/);
+ }).to.throw(/No corresponding JavaScript module found in the same directory/);
};
\ No newline at end of file
diff --git a/widgets/taglib/TransformHelper/handleRootNodes.js b/widgets/taglib/TransformHelper/handleRootNodes.js
index 8adec1777..ba5538fb8 100644
--- a/widgets/taglib/TransformHelper/handleRootNodes.js
+++ b/widgets/taglib/TransformHelper/handleRootNodes.js
@@ -199,7 +199,7 @@ module.exports = function handleRootNodes() {
var nextRef = 0;
rootNodes.forEach((curNode, i) => {
- curNode.setAttributeValue('w-bind');
+ curNode.setAttributeValue('_widgetbind');
if (!curNode.hasAttribute('ref')) {
if (curNode.type === 'CustomTag' || rootNodes.length > 1) {
diff --git a/widgets/taglib/TransformHelper/handleWidgetBind.js b/widgets/taglib/TransformHelper/handleWidgetBind.js
index c87aeed5e..62e1df3a2 100644
--- a/widgets/taglib/TransformHelper/handleWidgetBind.js
+++ b/widgets/taglib/TransformHelper/handleWidgetBind.js
@@ -57,24 +57,30 @@ module.exports = function handleWidgetBind() {
let context = this.context;
let builder = this.builder;
+ let internalBindAttr = el.getAttribute('_widgetbind');
let bindAttr = el.getAttribute('w-bind');
- if (bindAttr == null) {
+ let bindAttrValue;
+
+ if (internalBindAttr == null && bindAttr == null) {
return;
+ } else if (bindAttr != null) {
+ context.deprecate('The "w-bind" attribute is deprecated. Please remove it. See: https://github.com/marko-js/marko/issues/421');
+
+ // Remove the w-bind attribute since we don't want it showing up in the output DOM
+ el.removeAttribute('w-bind');
+
+ // Read the value for the w-bind attribute. This will be an AST node for the parsed JavaScript
+ bindAttrValue = bindAttr.value;
+ } else if (internalBindAttr != null) {
+ el.removeAttribute('_widgetbind');
}
- context.deprecate('The "w-bind" attribute is deprecated. Please remove it.');
-
- // Remove the w-bind attribute since we don't want it showing up in the output DOM
- el.removeAttribute('w-bind');
-
var isInnerBind = checkIsInnerBind(el.parentNode);
el.data.hasBoundWidget = true;
// A widget is bound to the el...
- // Read the value for the w-bind attribute. This will be an AST node for the parsed JavaScript
- let bindAttrValue = bindAttr.value;
let modulePath;
var widgetProps = isInnerBind ? {} : this.getWidgetProps();
@@ -94,7 +100,7 @@ module.exports = function handleWidgetBind() {
} else {
modulePath = this.getDefaultWidgetModule();
if (!modulePath) {
- this.addError('Invalid "w-bind" attribute. No corresponding JavaScript module found in the same directory (either "widget.js" or "index.js"). Actual: ' + modulePath);
+ this.addError('No corresponding JavaScript module found in the same directory (either "widget.js" or "index.js"). Actual: ' + modulePath);
return;
}
}
diff --git a/widgets/taglib/widgets-transformer.js b/widgets/taglib/widgets-transformer.js
index 21aa00993..63394e790 100644
--- a/widgets/taglib/widgets-transformer.js
+++ b/widgets/taglib/widgets-transformer.js
@@ -41,7 +41,7 @@ module.exports = function transform(el, context) {
return;
}
- if (el.hasAttribute('w-bind')) {
+ if (el.hasAttribute('_widgetbind') || el.hasAttribute('w-bind')) {
el.setFlag('hasWidgetBind');
transformHelper.handleWidgetBind();
}