Socket
Socket
Sign inDemoInstall

line-height

Package Overview
Dependencies
1
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 0.3.0

2

CHANGELOG.md
# line-height changelog
0.3.0 - Repaired support for textareas. Fixes #4
0.2.1 - Added new linting and simplified tests

@@ -3,0 +5,0 @@

2

component.json
{
"name": "line-height",
"repo": "twolfson/line-height",
"version": "0.2.1",
"version": "0.3.0",
"description": "Calculate line-height of an HTML element (IE6 compatible)",

@@ -6,0 +6,0 @@ "dependencies": {

@@ -65,2 +65,8 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.lineHeight = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

// If we have a text area, reset it to only 1 row
// https://github.com/twolfson/line-height/issues/4
if (nodeName.toUpperCase() === 'TEXTAREA') {
_node.setAttribute('rows', '1');
}
// Set the font-size of the element

@@ -70,2 +76,8 @@ var fontSizeStr = computedStyle(node, 'font-size');

// Remove default padding/border which can affect offset height
// https://github.com/twolfson/line-height/issues/4
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight
_node.style.padding = '0px';
_node.style.border = '0px';
// Append it to the body

@@ -72,0 +84,0 @@ var body = document.body;

@@ -64,2 +64,8 @@ // Load in dependencies

// If we have a text area, reset it to only 1 row
// https://github.com/twolfson/line-height/issues/4
if (nodeName.toUpperCase() === 'TEXTAREA') {
_node.setAttribute('rows', '1');
}
// Set the font-size of the element

@@ -69,2 +75,8 @@ var fontSizeStr = computedStyle(node, 'font-size');

// Remove default padding/border which can affect offset height
// https://github.com/twolfson/line-height/issues/4
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight
_node.style.padding = '0px';
_node.style.border = '0px';
// Append it to the body

@@ -71,0 +83,0 @@ var body = document.body;

{
"name": "line-height",
"description": "Calculate line-height of an HTML element (IE6 compatible)",
"version": "0.2.1",
"version": "0.3.0",
"homepage": "https://github.com/twolfson/line-height",

@@ -6,0 +6,0 @@ "author": {

@@ -300,1 +300,13 @@ // Load in test dependencies

});
// Verify we properly handle textareas
// https://github.com/twolfson/line-height/issues/4
describe('A textarea processed by line-height', function () {
testUtils.getLineHeight('<div><div id="div">abc</div><textarea id="textarea">def</textarea></div>');
it('has a line-height equal to a div\'s line-height', function () {
var divNode = document.getElementById('div');
var textareaNode = document.getElementById('textarea');
assert.strictEqual(lineHeight(divNode), lineHeight(textareaNode));
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc