// Open a batch: defer style application until the matching endBatch()
cy.startBatch(): thisOpen a batch: defer style application until the matching endBatch(). Pairs nest — only the outermost endBatch() flushes. Prefer batch( fn), which cannot leak a depth on an exception.
The outermost open is a transaction and fires batchstart on the core — before any of the batch's mutations, with batching() already true, so a listener sees the state the transaction starts from (the place to take an undo snapshot) and anything it mutates belongs to the transaction. A nested open fires nothing.
thisthis core, for chaining
Example
cy.startBatch();try { cy.getElementById('a').data('score', 5); }finally { cy.endBatch(); }console.log(cy.getElementById('a').data('score')); // 5