Remove the duplicated var price declaration from inside the head expression
The previous repair re-inserted "var price = ..." at the point it replaced, which landed between "var head = '...'" and its continuation. Semicolon insertion then ended the head statement early, so the price and everything after it fell out of the string and head rendered as a bare opening div. var price is already declared above; the continuation line just needs to follow the head assignment directly.
This commit is contained in:
parent
dc336db708
commit
9f7114ddbb
1 changed files with 3 additions and 9 deletions
12
script.html
12
script.html
|
|
@ -279,15 +279,9 @@ function render(r) {
|
|||
? r.quote.price_usd : Number(p.price_usd || 0);
|
||||
|
||||
var head = '<div class="quote" style="margin-bottom:22px">'
|
||||
// Built from a code point so no dollar sign sits against a quote in this
|
||||
// file's patch text - that sequence is a substitution token to
|
||||
// patch_git_file and once shipped a broken page (BROWSER_TESTS.md:265).
|
||||
// The price as the server computes it NOW. price_usd is stamped on the row
|
||||
// when the project is created, so it goes stale the moment the markup
|
||||
// constant changes - which it just did, from 5x to actual cost.
|
||||
var price = (r.quote && typeof r.quote.price_usd === 'number')
|
||||
? r.quote.price_usd : Number(p.price_usd || 0);
|
||||
|
||||
// The currency sign is the HTML entity, never the character. A dollar sign
|
||||
// next to a quote is a substitution token to patch_git_file, and a $
|
||||
// escape is no safer - it is decoded first and springs the same trap.
|
||||
+ '<div><div class="big">$' + Number(price).toFixed(2) + '</div>'
|
||||
+ '<div class="sub">' + videoSecondsOf(p) + ' seconds · ' + (p.segments || 4) + ' shots'
|
||||
+ (modelFor(p) ? ' · ' + esc(modelFor(p).label) : '') + '</div></div>'
|
||||
|
|
|
|||
Loading…
Reference in a new issue