Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully fail on invalid initial values #176

Merged
merged 1 commit into from
May 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions src/main/js/isd.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,31 @@

var iv = doc.head.styling.initials[ivs.qname] || ivs.initial;

if (iv === null) {
/* skip processing if no initial value defined */

continue;
}

/* apply initial value to elements other than region only if non-inherited */

if (isd_element.kind === 'region' || (ivs.inherit === false && iv !== null)) {

isd_element.styleAttrs[ivs.qname] = ivs.parse(iv);
var piv = ivs.parse(iv);

if (piv !== null) {

isd_element.styleAttrs[ivs.qname] = piv;

/* keep track of the style as specified */
/* keep track of the style as specified */

spec_attr[ivs.qname] = true;
spec_attr[ivs.qname] = true;

} else {

reportError(errorHandler, "Invalid initial value for '" + ivs.qname + "' on element '" + isd_element.kind);

}

}

Expand Down