Skip to content

cf-image and embedded content (base-64/svg) breaks answer html #172

@nuFaqtz

Description

@nuFaqtz

Hi,

When using embedded content for the src of the image (like base64 or svg) where, in most cases, single quotes are used within the attribute, rendering the answer for the user results in invalid html.
Changing:

var image = hasTagImage ? "<img src='" + this.referenceTag.domElement.getAttribute("cf-image") + "'/>" : "";

to

var image = hasTagImage ? "<img src=\"" + this.referenceTag.domElement.getAttribute("cf-image") + "\"/>" : "";

fixes this.

I have also experimented with image sizes and implemented two additional properties, cf-image-width and cf-image-height. When using radios with longer texts and images the images would scale enormously as the css sets its size to 100%.

if (hasTagImage) {
	var sizeHeight = this.referenceTag.domElement.getAttribute("cf-image-width");
	var sizeWidth = this.referenceTag.domElement.getAttribute("cf-image-height");
	image = "<img src=\"" + this.referenceTag.domElement.getAttribute("cf-image") + "\"";
	image += sizeHeight ? " height=\"" + sizeHeight + "\"" : "";
	image += sizeWidth ? " width=\"" + sizeWidth + "\"" : "";
	image += "/>";
}

mzZzl,
JamBo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions