Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: stevenbenner/jquery-powertip
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.3.2
Choose a base ref
...
head repository: stevenbenner/jquery-powertip
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 100 additions and 52 deletions.
  1. +30 −0 .github/workflows/run-tests.yml
  2. +2 −0 .npmignore
  3. +8 −0 CHANGELOG.yml
  4. +13 −13 Gruntfile.js
  5. +1 −1 LICENSE.txt
  6. +6 −1 README.md
  7. +1 −1 doc/README.md
  8. +1 −1 examples/examples.html
  9. +10 −10 package.json
  10. +2 −1 src/.eslintrc.json
  11. +1 −1 src/core.js
  12. +1 −1 src/csscoordinates.js
  13. +2 −1 src/displaycontroller.js
  14. +2 −2 src/utility.js
  15. +2 −2 src/wrapper.js
  16. +2 −2 test/.eslintrc.json
  17. +1 −1 test/amd.html
  18. +2 −2 test/amd.js
  19. +1 −1 test/edge-cases.html
  20. +4 −3 test/index.html
  21. +8 −8 test/unit/placementcalculator.js
30 changes: 30 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Run tests
on:
- push
- pull_request

jobs:
test:
name: Node ${{matrix.node}} on ${{matrix.os}}

strategy:
matrix:
os: [ ubuntu-latest ]
node: [ 20.x ]

runs-on: ${{matrix.os}}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js ${{matrix.node}}
uses: actions/setup-node@v4
with:
node-version: ${{matrix.node}}

- name: Install npm dependencies
run: npm install

- name: Test
run: npm test
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.github
/css
/doc
/examples
@@ -9,3 +10,4 @@
.npmignore
Gruntfile.js
*.tgz
*.zip
8 changes: 8 additions & 0 deletions CHANGELOG.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
v1.4.0:
date: TBA
diff: https://github.com/stevenbenner/jquery-powertip/compare/v1.3.2...master
description: TBA
changes:
- section: Features & Improvements
changes:
- Added support for jQuery version 4.
v1.3.2:
date: 2022-03-06
diff: https://github.com/stevenbenner/jquery-powertip/compare/v1.3.1...v1.3.2
26 changes: 13 additions & 13 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

'use strict';

module.exports = function(grunt) {
module.exports = function gruntConfig(grunt) {
// include grunt enhancements
require('time-grunt')(grunt);
require('jit-grunt')(grunt);
@@ -100,7 +100,7 @@ module.exports = function(grunt) {
dest: '<%= paths.build %>/<%= files.min %>',
options: {
output: {
comments: /^!/
comments: /^!/u
},
report: 'gzip',
ie8: true
@@ -113,8 +113,8 @@ module.exports = function(grunt) {
dest: '<%= paths.build %>/<%= files.cat %>',
options: {
process: (content) => {
let replaceRegex = /\s\/\* \[POWERTIP CODE\] \*\//,
coreFile = grunt.file.read(grunt.template.process('<%= concat.core.dest %>'));
const replaceRegex = /\s\/\* \[POWERTIP CODE\] \*\//u;
const coreFile = grunt.file.read(grunt.template.process('<%= concat.core.dest %>'));
return grunt.template.process(content).replace(replaceRegex, coreFile);
}
}
@@ -128,8 +128,8 @@ module.exports = function(grunt) {
dest: '<%= paths.build %>/',
options: {
process: (content) => {
let scriptsRegex = /<!-- begin-scripts -->(?:.*\r?\n\s)*<!-- end-scripts -->/,
builtScriptTag = '<script type="text/javascript" src="../<%= files.cat %>"></script>';
const scriptsRegex = /<!-- begin-scripts -->(?:.*\r?\n\s)*<!-- end-scripts -->/u;
const builtScriptTag = '<script type="text/javascript" src="../<%= files.cat %>"></script>';
return content.replace(scriptsRegex, grunt.template.process(builtScriptTag));
}
}
@@ -234,13 +234,13 @@ module.exports = function(grunt) {

// custom task to build the gh-pages index.md file
grunt.registerTask('build:gh-pages', 'Create the gh-pages markdown.', () => {
let template = grunt.file.read('doc/gh-pages.template.md'),
data = {
pkg: grunt.file.readJSON('package.json'),
doc: grunt.file.read('doc/README.md'),
changelog: grunt.file.readYAML(grunt.template.process('<%= files.changelog %>'))
},
page = grunt.template.process(template, { data: data });
const template = grunt.file.read('doc/gh-pages.template.md');
const data = {
pkg: grunt.file.readJSON('package.json'),
doc: grunt.file.read('doc/README.md'),
changelog: grunt.file.readYAML(grunt.template.process('<%= files.changelog %>'))
};
const page = grunt.template.process(template, { data: data });
grunt.file.write('dist/index.md', page);
grunt.log.ok('gh-pages markdown created');
});
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2022 Steven Benner (https://stevenbenner.com/)
Copyright (c) 2012-2024 Steven Benner (https://stevenbenner.com/)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -4,9 +4,14 @@ PowerTip is a jQuery tooltip plugin with some advanced features like **hover int

This software is licensed under the [MIT license][license].

[![Release Version](https://img.shields.io/github/release/stevenbenner/jquery-powertip.svg?style=flat-square)][projectpage] [![NPM Version](https://img.shields.io/npm/v/jquery-powertip.svg?style=flat-square)][npmpage]
[![Release Version][releasebadge]][releases] [![NPM Version][npmbadge]][npmpage] [![Test Status][testbadge]][teststatus]

[license]: LICENSE.txt
[releases]: https://github.com/stevenbenner/jquery-powertip/releases
[teststatus]: https://github.com/stevenbenner/jquery-powertip/actions/workflows/run-tests.yml
[releasebadge]: https://img.shields.io/github/release/stevenbenner/jquery-powertip.svg?style=flat-square
[npmbadge]: https://img.shields.io/npm/v/jquery-powertip.svg?style=flat-square
[testbadge]: https://img.shields.io/github/actions/workflow/status/stevenbenner/jquery-powertip/run-tests.yml?style=flat-square

## Getting Started

2 changes: 1 addition & 1 deletion doc/README.md
Original file line number Diff line number Diff line change
@@ -108,7 +108,7 @@ Example paths configuration:
```javascript
require.config({
paths: {
jquery: 'https://code.jquery.com/jquery-3.6.0',
jquery: 'https://code.jquery.com/jquery-3.7.1',
'jquery.powertip': '../dist/jquery.powertip'
}
});
2 changes: 1 addition & 1 deletion examples/examples.html
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
#events-examples input, #api-examples input { margin: 10px; padding: 10px 30px; }
</style>
<!-- Include jQuery and PowerTip -->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.7.1.js"></script>
<!-- begin-scripts -->
<script type="text/javascript" src="../src/core.js"></script>
<script type="text/javascript" src="../src/csscoordinates.js"></script>
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -28,26 +28,26 @@
"browser"
],
"dependencies": {
"jquery": ">=1.7 <4.0"
"jquery": "1.7 - 4"
},
"devDependencies": {
"@stevenbenner/eslint-config": "~2.0",
"grunt": "~1.4",
"@stevenbenner/eslint-config": "~3.0",
"grunt": "~1.6",
"grunt-browserify": "~6.0",
"grunt-contrib-clean": "~2.0",
"grunt-contrib-compress": "~2.0",
"grunt-contrib-concat": "~2.0",
"grunt-contrib-concat": "~2.1",
"grunt-contrib-copy": "~1.0",
"grunt-contrib-csslint": "~2.0",
"grunt-contrib-cssmin": "~4.0",
"grunt-contrib-qunit": "~5.1",
"grunt-contrib-uglify": "~5.0",
"grunt-eslint": "~24.0",
"grunt-contrib-cssmin": "~5.0",
"grunt-contrib-qunit": "~8.0",
"grunt-contrib-uglify": "~5.2",
"grunt-eslint": "~24.3",
"grunt-indent": "~1.0",
"grunt-jsonlint": "~2.1",
"grunt-shell": "~3.0",
"grunt-shell": "~4.0",
"jit-grunt": "~0.10",
"qunit": "~2.18",
"qunit": "~2.20",
"time-grunt": "~2.0"
},
"scripts": {
3 changes: 2 additions & 1 deletion src/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
"error",
"never"
],
"no-var": "off"
"no-var": "off",
"prefer-template": "off"
}
}
2 changes: 1 addition & 1 deletion src/core.js
Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@ $.fn.powerTip = function(opts, arg) {
}

// handle api method calls on the plugin, e.g. powerTip('hide')
if ($.type(opts) === 'string' && $.powerTip[opts]) {
if (typeof opts === 'string' && $.powerTip[opts]) {
return $.powerTip[opts].call(targetElements, targetElements, arg);
}

2 changes: 1 addition & 1 deletion src/csscoordinates.js
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ function CSSCoordinates() {
* @param {number} value The value of the property.
*/
me.set = function(property, value) {
if ($.isNumeric(value)) {
if (typeof value === 'number') {
me[property] = Math.round(value);
}
};
3 changes: 2 additions & 1 deletion src/displaycontroller.js
Original file line number Diff line number Diff line change
@@ -60,7 +60,8 @@ function DisplayController(element, options, tipController) {
function closeTooltip(disableDelay) {
// if this instance already has a close delay in progress then halt it
if (myCloseDelay) {
myCloseDelay = session.closeDelayTimeout = clearTimeout(myCloseDelay);
session.closeDelayTimeout = clearTimeout(myCloseDelay);
myCloseDelay = session.closeDelayTimeout;
session.delayInProgress = false;
}
cancelTimer();
4 changes: 2 additions & 2 deletions src/utility.js
Original file line number Diff line number Diff line change
@@ -135,12 +135,12 @@ function getTooltipContent(element) {
content;

if (tipText) {
if ($.isFunction(tipText)) {
if (typeof tipText === 'function') {
tipText = tipText.call(element[0]);
}
content = tipText;
} else if (tipObject) {
if ($.isFunction(tipObject)) {
if (typeof tipObject === 'function') {
tipObject = tipObject.call(element[0]);
}
if (tipObject.length > 0) {
4 changes: 2 additions & 2 deletions src/wrapper.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*!
<%= pkg.title %> v<%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>)
<%= pkg.homepage %>
Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> (<%= pkg.author.url %>).
Copyright (c) 2012-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %> (<%= pkg.author.url %>).
Released under <%= pkg.license %> license.
https://raw.github.com/stevenbenner/jquery-powertip/master/<%= files.license %>
https://github.com/stevenbenner/jquery-powertip/blob/master/<%= files.license %>
*/
(function(root, factory) {
// support loading the plugin via common patterns
4 changes: 2 additions & 2 deletions test/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -10,9 +10,9 @@
"node": false
},
"rules": {
"require-jsdoc": "off",
"no-prototype-builtins": "off",
"no-var": "off"
"no-var": "off",
"prefer-template": "off"
},
"globals": {
"DATA_DISPLAYCONTROLLER": false,
2 changes: 1 addition & 1 deletion test/amd.html
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
<title>PowerTip AMD Test Suite</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.js"></script>
<script type="text/javascript" src="amd.js"></script>
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/qunit/qunit-2.18.0.css" />
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/qunit/qunit-2.20.0.css" />
</head>
<body>
<div id="qunit"></div>
4 changes: 2 additions & 2 deletions test/amd.js
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@

require.config({
paths: {
jquery: 'https://code.jquery.com/jquery-3.6.0',
qunit: 'https://code.jquery.com/qunit/qunit-2.18.0',
jquery: 'https://code.jquery.com/jquery-3.7.1',
qunit: 'https://code.jquery.com/qunit/qunit-2.20.0',
'jquery.powertip': '../dist/jquery.powertip'
}
});
2 changes: 1 addition & 1 deletion test/edge-cases.html
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
<title>PowerTip Edge Case Tests</title>

<!-- Library Resources -->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.7.1.js"></script>

<!-- PowerTip Core Resources -->
<script type="text/javascript" src="../src/core.js"></script>
7 changes: 4 additions & 3 deletions test/index.html
Original file line number Diff line number Diff line change
@@ -5,12 +5,12 @@
<title>PowerTip Test Suite</title>

<!-- QUnit Resources -->
<script type="text/javascript" src="https://code.jquery.com/qunit/qunit-2.18.0.js"></script>
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/qunit/qunit-2.18.0.css" />
<script type="text/javascript" src="https://code.jquery.com/qunit/qunit-2.20.0.js"></script>
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/qunit/qunit-2.20.0.css" />

<!-- Dynamic jQuery Version Loader -->
<script type="text/javascript">
var jqVersions = [ '1.7.0', '1.12.4', '2.2.4', '3.6.0' ],
var jqVersions = [ '1.7.0', '1.12.4', '2.2.4', '3.7.1', '4.0.0-beta' ],
currentJq = QUnit.urlParams.jquery || jqVersions[jqVersions.length - 1];

QUnit.config.urlConfig.push({
@@ -20,6 +20,7 @@
tooltip: 'Select which version of jQuery to run the test suite on.'
});

console.log('Running test suite against jQuery version ' + currentJq + '.\n');
document.write('<script src="https://code.jquery.com/jquery-' + currentJq + '.js">\x3C/script>');
</script>

16 changes: 8 additions & 8 deletions test/unit/placementcalculator.js
Original file line number Diff line number Diff line change
@@ -41,33 +41,33 @@ $(function() {
case 'ne':
case 'nw-alt':
assert.strictEqual(coords.top, 'auto', key + ': top property is set to auto');
assert.strictEqual($.isNumeric(coords.left), true, key + ': left property is set to a number');
assert.strictEqual(typeof coords.left, 'number', key + ': left property is set to a number');
assert.strictEqual(coords.right, 'auto', key + ': right property is set to auto');
assert.strictEqual($.isNumeric(coords.bottom), true, key + ': bottom property is set to a number');
assert.strictEqual(typeof coords.bottom, 'number', key + ': bottom property is set to a number');
break;
case 'e':
case 's':
case 'se':
case 'sw-alt':
assert.strictEqual($.isNumeric(coords.top), true, key + ': top property is set to a number');
assert.strictEqual($.isNumeric(coords.left), true, key + ': left property is set to a number');
assert.strictEqual(typeof coords.top, 'number', key + ': top property is set to a number');
assert.strictEqual(typeof coords.left, 'number', key + ': left property is set to a number');
assert.strictEqual(coords.right, 'auto', key + ': right property is set to auto');
assert.strictEqual(coords.bottom, 'auto', key + ': bottom property is set to auto');
break;
case 'w':
case 'sw':
case 'se-alt':
assert.strictEqual($.isNumeric(coords.top), true, key + ': top property is set to a number');
assert.strictEqual(typeof coords.top, 'number', key + ': top property is set to a number');
assert.strictEqual(coords.left, 'auto', key + ': left property is set to auto');
assert.strictEqual($.isNumeric(coords.right), true, key + ': right property is set to a number');
assert.strictEqual(typeof coords.right, 'number', key + ': right property is set to a number');
assert.strictEqual(coords.bottom, 'auto', key + ': bottom property is set to auto');
break;
case 'nw':
case 'ne-alt':
assert.strictEqual(coords.top, 'auto', key + ': top property is set to auto');
assert.strictEqual(coords.left, 'auto', key + ': left property is set to auto');
assert.strictEqual($.isNumeric(coords.right), true, key + ': right property is set to a number');
assert.strictEqual($.isNumeric(coords.bottom), true, key + ': bottom property is set to a number');
assert.strictEqual(typeof coords.right, 'number', key + ': right property is set to a number');
assert.strictEqual(typeof coords.bottom, 'number', key + ': bottom property is set to a number');
break;
}
});