-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #560 from eBay/559-ebay-button-id
Fix providing id attribute to ebay button
- Loading branch information
Showing
5 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const markoWidgets = require('marko-widgets'); | ||
|
||
/** | ||
* Hack to get the widget id before w-bind in Marko 3. | ||
* In Marko 4 this will return undefined, which means no id. | ||
*/ | ||
module.exports = function(out) { | ||
const widgetArgs = out.data.widgetArgs; | ||
if (widgetArgs) { | ||
return `${widgetArgs.scope}-${widgetArgs.id}`; | ||
} | ||
|
||
const ctx = markoWidgets.getWidgetsContext && markoWidgets.getWidgetsContext(out); | ||
return ctx && ctx._nextWidgetId(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters