From fbf307c648ae0e92679c54f7d03f197a75b4e101 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Wed, 20 Aug 2014 10:00:34 +0100 Subject: [PATCH] Add alt attribute to image widget --- core/modules/widgets/image.js | 4 ++++ editions/tw5.com/tiddlers/widgets/ImageWidget.tid | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/modules/widgets/image.js b/core/modules/widgets/image.js index be2ea8b6f..1c4ba494e 100644 --- a/core/modules/widgets/image.js +++ b/core/modules/widgets/image.js @@ -105,6 +105,9 @@ ImageWidget.prototype.render = function(parent,nextSibling) { if(this.imageTooltip) { domNode.setAttribute("title",this.imageTooltip); } + if(this.imageAlt) { + domNode.setAttribute("alt",this.imageAlt); + } // Insert element parent.insertBefore(domNode,nextSibling); this.domNodes.push(domNode); @@ -120,6 +123,7 @@ ImageWidget.prototype.execute = function() { this.imageHeight = this.getAttribute("height"); this.imageClass = this.getAttribute("class"); this.imageTooltip = this.getAttribute("tooltip"); + this.imageAlt = this.getAttribute("alt"); }; /* diff --git a/editions/tw5.com/tiddlers/widgets/ImageWidget.tid b/editions/tw5.com/tiddlers/widgets/ImageWidget.tid index 6f1e1a694..d766732aa 100644 --- a/editions/tw5.com/tiddlers/widgets/ImageWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/ImageWidget.tid @@ -1,6 +1,6 @@ title: ImageWidget created: 20140416160234142 -modified: 20140611160234142 +modified: 20140820100234142 tags: widget ! Introduction @@ -16,6 +16,7 @@ Any content of the `<$image>` widget is ignored. |width |The width of the image as a number | |height |The height of the image | |tooltip |The tooltip to be displayed over the image | +|alt |The alternative text to be associated with the image | |class |CSS classes to be assigned to the `` element | ! External Images and the ''_canonical_uri'' field