Skip to content

Commit

Permalink
$.fn.css: added support for retrieving properties of disconnected nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiospampinato committed Apr 15, 2020
1 parent 6bdcfa2 commit 776a83c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/css/helpers/compute_style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ function computeStyle ( ele: EleLoose, prop: string, isVariable?: boolean ): str

const style = win.getComputedStyle ( ele, null );

return isVariable ? style.getPropertyValue ( prop ) || undefined : style[prop];
return isVariable ? style.getPropertyValue ( prop ) || undefined : style[prop] || ele.style[prop];

}
10 changes: 10 additions & 0 deletions test/modules/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ describe ( 'CSS', { beforeEach: getFixtureInit ( fixture ) }, function () {

});

it ( 'gets the value of a property (disconnected node)', function ( t ) {

var ele = $('<div></div>');

ele.css ({ top: 10 });

t.is ( ele.css ( 'top' ), '10px' );

});

it ( 'sets the value of a property', function ( t ) {

var ele = $('.css');
Expand Down

0 comments on commit 776a83c

Please sign in to comment.