.github/workflows/rebase.yml000066400000000372151122355130012127 0ustar00name: Automatic Rebase on: [pull_request] jobs: _: name: "Automatic Rebase" runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: ljharb/rebase@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} .github/FUNDING.yml000066400000001114151122355130007716 0ustar00# These are supported funding model platforms github: [ljharb] patreon: # Replace with a single Patreon username open_collective: # Replace with a single Open Collective username ko_fi: # Replace with a single Ko-fi username tidelift: npm/document.contains community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] .eslintrc000066400000000213151122355130006364 0ustar00{ "root": true, "extends": "@ljharb", "env": { "browser": true, }, "rules": { "max-statements": 0, "no-magic-numbers": 0, }, } .travis.yml000066400000000435151122355130006657 0ustar00version: ~> 1.0 language: node_js os: - linux import: - ljharb/travis-ci:node/all.yml - ljharb/travis-ci:node/pretest.yml - ljharb/travis-ci:node/posttest.yml - ljharb/travis-ci:node/coverage.yml matrix: allow_failures: - env: COVERAGE=true # temporarily allow this to fail CHANGELOG.md000066400000006632151122355130006364 0ustar00# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). ## [v1.0.2](https://github.com/ljharb/document.contains/compare/v1.0.1...v1.0.2) - 2020-06-13 ### Fixed - [Fix] `polyfill`: avoid `document.contains()` crash in IE 11 [`#11`](https://github.com/ljharb/document.contains/issues/11) ### Commits - [meta] add `auto-changelog` [`e9bc62c`](https://github.com/ljharb/document.contains/commit/e9bc62cbc688a80ea995b836c61a704bc172580c) - [Tests] use shared travis-ci configs [`6bd244b`](https://github.com/ljharb/document.contains/commit/6bd244b3e1514952441ec1af63fdb719e4eb0a47) - [actions] add automatic rebasing / merge commit blocking [`f18f3cf`](https://github.com/ljharb/document.contains/commit/f18f3cf306912cffb29f7833cc781e4772f7e451) - [meta] create FUNDING.yml [`d4537ff`](https://github.com/ljharb/document.contains/commit/d4537ff68af1978741ce1cdb15221b897c80f225) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`; add `safe-publish-latest` [`1501bd8`](https://github.com/ljharb/document.contains/commit/1501bd8e8c5e536f08b531c1d60357d374f7c3f7) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`; add `aud` [`c245ac2`](https://github.com/ljharb/document.contains/commit/c245ac2c94155de589ea82fa3c0f27a9ab7de03e) - [meta] add `funding` field [`3ffa6ed`](https://github.com/ljharb/document.contains/commit/3ffa6ed3ee84a5280cd8471c59708de6cba34d3e) - [Dev Deps] update `eslint` [`468c649`](https://github.com/ljharb/document.contains/commit/468c649edf43cdaf20b875f7003281c9d181a604) - [Dev Deps] update `auto-changelog` [`336f993`](https://github.com/ljharb/document.contains/commit/336f99349cad51d3b19aeec62feca219d0049163) - [Tests] only audit prod deps [`21aee94`](https://github.com/ljharb/document.contains/commit/21aee94f175f8009fe330e636905c51c554cc377) - [Dev Deps] update `auto-changelog` [`34fefbc`](https://github.com/ljharb/document.contains/commit/34fefbc030e556e0fc86f8a75f0ab87e8d7960e3) - [Dev Deps] update `@ljharb/eslint-config` [`3289972`](https://github.com/ljharb/document.contains/commit/3289972468a73bf1f0a190cddb0254928aedd3df) ## [v1.0.1](https://github.com/ljharb/document.contains/compare/v1.0.0...v1.0.1) - 2019-03-15 ### Commits - [Fix] Prevent IE from throwing an exception as its document does not have a body property. [`7639260`](https://github.com/ljharb/document.contains/commit/763926012272e7adf39267d1a9bb872e2e6a9f89) ## v1.0.0 - 2019-03-10 ### Commits - Initial implementation [`ae7f290`](https://github.com/ljharb/document.contains/commit/ae7f29091502fd913ee657d8f59c46ba247688b1) - Initial commit [`f8acce8`](https://github.com/ljharb/document.contains/commit/f8acce880902ab80dcde4488460ec3c815ede127) - package.json [`019ed45`](https://github.com/ljharb/document.contains/commit/019ed45c67b3610c8d09a1ab9128cbbf03c028ee) - [Tests] add `npm run lint` [`f77b234`](https://github.com/ljharb/document.contains/commit/f77b234a5be8b0dc7665ef193922625cec48347d) - Only apps should have lockfiles [`3db618e`](https://github.com/ljharb/document.contains/commit/3db618e645be4e497a681e68cfcb04f7f6ccf95e) - [Tests] use `npx aud` (ie, `npm audit`) [`15c0b84`](https://github.com/ljharb/document.contains/commit/15c0b840044250f186b61061da3b55b26e59952b) LICENSE000066400000002057151122355130005555 0ustar00MIT License Copyright (c) 2019 Jordan Harband Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. README.md000066400000000072151122355130006022 0ustar00# document.contains Polyfill/shim for `document.contains` auto.js000066400000000044151122355130006050 0ustar00'use strict'; require('./shim')(); implementation.js000066400000000647151122355130010136 0ustar00'use strict'; module.exports = function contains(other) { if (arguments.length < 1) { throw new TypeError('1 argument is required'); } if (typeof other !== 'object') { throw new TypeError('Argument 1 (”other“) to Node.contains must be an instance of Node'); } var node = other; do { if (this === node) { return true; } if (node) { node = node.parentNode; } } while (node); return false; }; index.js000066400000000670151122355130006214 0ustar00'use strict'; var define = require('define-properties'); var implementation = require('./implementation'); var getPolyfill = require('./polyfill'); var polyfill = getPolyfill(); var shim = require('./shim'); var boundContains = function contains(node, other) { return polyfill.apply(node, [other]); }; define(boundContains, { getPolyfill: getPolyfill, implementation: implementation, shim: shim }); module.exports = boundContains; package.json000066400000004577151122355130007047 0ustar00{ "_args": [ [ "document.contains@1.0.2", "/home/freeclou/app.optimyar.com/backend" ] ], "_from": "document.contains@1.0.2", "_id": "document.contains@1.0.2", "_inBundle": false, "_integrity": "sha512-YcvYFs15mX8m3AO1QNQy3BlIpSMfNRj3Ujk2BEJxsZG+HZf7/hZ6jr7mDpXrF8q+ff95Vef5yjhiZxm8CGJr6Q==", "_location": "/document.contains", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, "raw": "document.contains@1.0.2", "name": "document.contains", "escapedName": "document.contains", "rawSpec": "1.0.2", "saveSpec": null, "fetchSpec": "1.0.2" }, "_requiredBy": [ "/react-outside-click-handler" ], "_resolved": "https://registry.npmjs.org/document.contains/-/document.contains-1.0.2.tgz", "_spec": "1.0.2", "_where": "/home/freeclou/app.optimyar.com/backend", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com" }, "auto-changelog": { "output": "CHANGELOG.md", "template": "keepachangelog", "unreleased": false, "commitLimit": false, "backfillLimit": false }, "bugs": { "url": "https://github.com/ljharb/document.contains/issues" }, "dependencies": { "define-properties": "^1.1.3" }, "description": "Polyfill/shim for `document.contains`", "devDependencies": { "@es-shims/api": "^2.1.2", "@ljharb/eslint-config": "^17.1.0", "aud": "^1.1.2", "auto-changelog": "^2.0.0", "eslint": "^7.2.0", "safe-publish-latest": "^1.1.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" }, "homepage": "https://github.com/ljharb/document.contains#readme", "keywords": [ "contains", "document", "element", "node", "polyfill", "shim" ], "license": "MIT", "main": "index.js", "name": "document.contains", "repository": { "type": "git", "url": "git+https://github.com/ljharb/document.contains.git" }, "scripts": { "lint": "eslint .", "posttest": "npx aud --production", "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"", "prepublish": "safe-publish-latest", "pretest": "npm run lint", "test": "npm run tests-only", "tests-only": "es-shim-api --bound", "version": "auto-changelog && git add CHANGELOG.md" }, "version": "1.0.2" } polyfill.js000066400000000670151122355130006737 0ustar00'use strict'; var implementation = require('./implementation'); module.exports = function getPolyfill() { if (typeof document !== 'undefined') { if (document.contains) { return document.contains; } if (document.body && document.body.contains) { try { if (typeof document.body.contains.call(document, '') === 'boolean') { return document.body.contains; } } catch (e) { /**/ } } } return implementation; }; shim.js000066400000001057151122355130006045 0ustar00'use strict'; var define = require('define-properties'); var getPolyfill = require('./polyfill'); module.exports = function shimContains() { var polyfill = getPolyfill(); if (typeof document !== 'undefined') { define( document, { contains: polyfill }, { contains: function () { return document.contains !== polyfill; } } ); if (typeof Element !== 'undefined') { define( Element.prototype, { contains: polyfill }, { contains: function () { return Element.prototype.contains !== polyfill; } } ); } } return polyfill; };