Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 5x 5x 5x 5x 5x 5x 5x 5x 225x 225x 225x 225x 225x 225x 225x 225x 225x 225x 225x 2x 2x 223x 223x 225x | import Transaction from "../transaction"; /** * Allows the transaction to terminate early if no contents have changed. * * @param {Transaction} transaction */ export default function shouldUpdate(transaction) { const { mount, input, state: { measure }, config: options } = transaction; const prop = options.inner ? 'innerHTML' : 'outerHTML'; measure('should update'); const mountAsHTMLEl = /** @type {HTMLElement} */ (mount); // If the contents haven't changed, abort the flow. Only support this if // the new markup is a string, otherwise it's possible for our object // recycling to match twice. if (typeof input === 'string' && mountAsHTMLEl[prop]=== input) { return transaction.abort(true); } measure('should update'); } |