Summary
Setting element.style.top with a length value does not work in jsdom 27.4.0. The negative value is silently discarded and style.top returns an empty string.
Other positioning properties like left, right, bottom work correctly.
Reproduction
const { JSDOM } = require('jsdom');
const dom = new JSDOM('<!DOCTYPE html><html><body><div></div></body></html>');
const div = dom.window.document.querySelector('div');
// Bug: style.top doesn't work
div.style.top = '-10px';
console.log('style.top:', div.style.top); // Expected: '-10px', Actual: ''
// These work correctly
div.style.left = '20px';
console.log('style.left:', div.style.left); // '20px' ✓
div.style.bottom = '30px';
console.log('style.bottom:', div.style.bottom); // '30px' ✓
div.style.right = '40px';
console.log('style.right:', div.style.right); // '40px' ✓
Expected Behavior
div.style.top = '-10px' should set the top property to -10px.
Actual Behavior
div.style.top returns an empty string '' after assignment.
Environment
- jsdom version: 27.4.0
- cssstyle version: 5.3.6
- Node.js version: (your version)
- OS: (your OS)
Additional Context
- Works in jsdom 27.3.0 (cssstyle 5.3.4)
- Broken in jsdom 27.4.0 (cssstyle 5.3.6)
The regression appears to be introduced in cssstyle 5.3.5 or 5.3.6.
Summary
Setting
element.style.topwith a length value does not work in jsdom 27.4.0. The negative value is silently discarded andstyle.topreturns an empty string.Other positioning properties like
left,right,bottomwork correctly.Reproduction
Expected Behavior
div.style.top = '-10px'should set the top property to-10px.Actual Behavior
div.style.topreturns an empty string''after assignment.Environment
Additional Context
The regression appears to be introduced in cssstyle 5.3.5 or 5.3.6.