diff --git a/Salesforce.cer b/Salesforce.cer new file mode 100644 index 0000000..fffc1f7 --- /dev/null +++ b/Salesforce.cer @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIIC8DCCAdigAwIBAgIQf6unXdhk47ZCv3vbgNEZ1jANBgkqhkiG9w0BAQsFADA0MTIwMAYDVQQD +EylNaWNyb3NvZnQgQXp1cmUgRmVkZXJhdGVkIFNTTyBDZXJ0aWZpY2F0ZTAeFw0yNDA1MDgwNDQw +NDRaFw0yNzA1MDgwNDQwNDRaMDQxMjAwBgNVBAMTKU1pY3Jvc29mdCBBenVyZSBGZWRlcmF0ZWQg +U1NPIENlcnRpZmljYXRlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyReHuW5fr1uv +A/c7BJARso0zEWr+t1yodFguKyVkSq4xQ8HPGChfaknlZlvuYww75JS90b5nuXwcReHFMPBcZ8P6 +iCyb3etNYOetX37d3Lj+w14R8hPCxIkbG+r26OWI+Udoge/0gi/Uz24w8q3uy1R1d+gUQrTqafMA +9WMBx/pOjjKvSHg/s2nLOv4WcWC1gCRTp12H2ppR9NP3KZ5FZXdJnw0Hvxi18ADIaV+tFvIvvluD +aAqdYmGKFWAO1nEsrQjSWx3Lm0DMiiiRz7BcGy6OgVEmE6b8vXTuLO5fkmBc8d7OWdV4s6xyjQCh +DkN/TyXpTxiQ71TR+O6c1yE37QIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQAe7HVo787amjvc3Op0 +R45vC4YhDFR5N9v7A6AtUL0JvD4UxXofkUdEF7unRScLfrPKRlsW/ZT5y98WishA/sqZ/CXWHwP5 +G88xwZO2M+eeXpUfQFhJh1LFoFOhOnvs4aaJP2PC3Xyel72/zdGozut2hQIHrJ4ifYuUFTG5AXay +J1rTARkQ+GdRNezxE9BiyMs0EUIloAoNRu/EiTRXuTcnk1b3o1yi+ADvitrsH7JWkJm4f8b9Ydtb +i1pJmk7Qy+ardZNVOuFh+ErX7/N9NMYA11EcJlqgdYja7uU/Y9sMKDIIE9h5sdUVou/zfZsukKCG +zt1H16XMLZ610TwDgrcv +-----END CERTIFICATE----- diff --git a/Salesforce.xml b/Salesforce.xml new file mode 100644 index 0000000..d9e7851 --- /dev/null +++ b/Salesforce.xml @@ -0,0 +1 @@ +AZCrBd0WsEodWDT2MxemcURTZ3QkB6+Qi8Z7UjZlKYk=SQWJLtpy53b+LtizaNRAk3h5+FA4axZfGdqEMvoBhSYbWNbgVYwUkF9HqaWKeiow3LFRJ88EIuQf3iLR9qaD06mrTK0ulFIo0/DU+REMZK+IGzJ1bMsstD7L0eBAiICea62iw/dQF4KV64JKvkvp9ZQ+Ithxau4C5Zypj9cr0fg9SjesPJHTNEFSMlpF12o1U6bV7O+48NIkzwxEzQ8snNpqF5kybfp9r64Ltfzcajmd4uR15+X417ZXnie98HJE7egc5zyYiLe6qo+uYh0T2i428Qwg7r+0oSkZi4w5dmSEg249Hb5FjnY3Pe8Q1jCh0W19TXURyi0UQqi2a/Thaw==MIIC8DCCAdigAwIBAgIQf6unXdhk47ZCv3vbgNEZ1jANBgkqhkiG9w0BAQsFADA0MTIwMAYDVQQDEylNaWNyb3NvZnQgQXp1cmUgRmVkZXJhdGVkIFNTTyBDZXJ0aWZpY2F0ZTAeFw0yNDA1MDgwNDQwNDRaFw0yNzA1MDgwNDQwNDRaMDQxMjAwBgNVBAMTKU1pY3Jvc29mdCBBenVyZSBGZWRlcmF0ZWQgU1NPIENlcnRpZmljYXRlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyReHuW5fr1uvA/c7BJARso0zEWr+t1yodFguKyVkSq4xQ8HPGChfaknlZlvuYww75JS90b5nuXwcReHFMPBcZ8P6iCyb3etNYOetX37d3Lj+w14R8hPCxIkbG+r26OWI+Udoge/0gi/Uz24w8q3uy1R1d+gUQrTqafMA9WMBx/pOjjKvSHg/s2nLOv4WcWC1gCRTp12H2ppR9NP3KZ5FZXdJnw0Hvxi18ADIaV+t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vXTuLO5fkmBc8d7OWdV4s6xyjQChDkN/TyXpTxiQ71TR+O6c1yE37QIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQAe7HVo787amjvc3Op0R45vC4YhDFR5N9v7A6AtUL0JvD4UxXofkUdEF7unRScLfrPKRlsW/ZT5y98WishA/sqZ/CXWHwP5G88xwZO2M+eeXpUfQFhJh1LFoFOhOnvs4aaJP2PC3Xyel72/zdGozut2hQIHrJ4ifYuUFTG5AXayJ1rTARkQ+GdRNezxE9BiyMs0EUIloAoNRu/EiTRXuTcnk1b3o1yi+ADvitrsH7JWkJm4f8b9Ydtbi1pJmk7Qy+ardZNVOuFh+ErX7/N9NMYA11EcJlqgdYja7uU/Y9sMKDIIE9h5sdUVou/zfZsukKCGzt1H16XMLZ610TwDgrcvNameThe mutable display name of the user.SubjectAn immutable, globally unique, non-reusable identifier of the user that is unique to the application for which a token is issued.Given NameFirst name of the user.SurnameLast name of the user.Display NameDisplay name of the user.Nick NameNick name of the user.Authentication InstantThe time (UTC) when the user is authenticated to Windows Azure Active Directory.Authentication MethodThe method that Windows Azure Active Directory uses to authenticate users.ObjectIdentifierPrimary identifier for the user in the directory. Immutable, globally unique, non-reusable.TenantIdIdentifier for the user's tenant.IdentityProviderIdentity provider for the user.EmailEmail address of the user.GroupsGroups of the user.External Access TokenAccess token issued by external identity provider.External Access Token ExpirationUTC expiration time of access token issued by external identity provider.External OpenID 2.0 IdentifierOpenID 2.0 identifier issued by external identity provider.GroupsOverageClaimIssued when number of user's group claims exceeds return limit.Role ClaimRoles that the user or Service Principal is attached toRoleTemplate Id ClaimRole template id of the Built-in Directory Roles that the user is a member ofhttps://login.microsoftonline.com/0085be9c-68bc-4bd8-925e-a15a6d413749/wsfedhttps://login.microsoftonline.com/0085be9c-68bc-4bd8-925e-a15a6d413749/wsfedMIIC8DCCAdigAwIBAgIQf6unXdhk47ZCv3vbgNEZ1jANBgkqhkiG9w0BAQsFADA0MTIwMAYDVQQDEylNaWNyb3NvZnQgQXp1cmUgRmVkZXJhdGVkIFNTTyBDZXJ0aWZpY2F0ZTAeFw0yNDA1MDgwNDQwNDRaFw0yNzA1MDgwNDQwNDRaMDQxMjAwBgNVBAMTKU1pY3Jvc29mdCBBenVyZSBGZWRlcmF0ZWQgU1NPIENlcnRpZmljYXRlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyReHuW5fr1uvA/c7BJARso0zEWr+t1yodFguKyVkSq4xQ8HPGChfaknlZlvuYww75JS90b5nuXwcReHFMPBcZ8P6iCyb3etNYOetX37d3Lj+w14R8hPCxIkbG+r26OWI+Udoge/0gi/Uz24w8q3uy1R1d+gUQrTqafMA9WMBx/pOjjKvSHg/s2nLOv4WcWC1gCRTp12H2ppR9NP3KZ5FZXdJnw0Hvxi18ADIaV+tFvIvvluDaAqdYmGKFWAO1nEsrQjSWx3Lm0DMiiiRz7BcGy6OgVEmE6b8vXTuLO5fkmBc8d7OWdV4s6xyjQChDkN/TyXpTxiQ71TR+O6c1yE37QIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQAe7HVo787amjvc3Op0R45vC4YhDFR5N9v7A6AtUL0JvD4UxXofkUdEF7unRScLfrPKRlsW/ZT5y98WishA/sqZ/CXWHwP5G88xwZO2M+eeXpUfQFhJh1LFoFOhOnvs4aaJP2PC3Xyel72/zdGozut2hQIHrJ4ifYuUFTG5AXayJ1rTARkQ+GdRNezxE9BiyMs0EUIloAoNRu/EiTRXuTcnk1b3o1yi+ADvitrsH7JWkJm4f8b9Ydtbi1pJmk7Qy+ardZNVOuFh+ErX7/N9NMYA11EcJlqgdYja7uU/Y9sMKDIIE9h5sdUVou/zfZsukKCGzt1H16XMLZ610TwDgrcvhttps://sts.windows.net/0085be9c-68bc-4bd8-925e-a15a6d413749/https://login.microsoftonline.com/0085be9c-68bc-4bd8-925e-a15a6d413749/wsfedhttps://login.microsoftonline.com/0085be9c-68bc-4bd8-925e-a15a6d413749/wsfedMIIC8DCCAdigAwIBAgIQf6unXdhk47ZCv3vbgNEZ1jANBgkqhkiG9w0BAQsFADA0MTIwMAYDVQQDEylNaWNyb3NvZnQgQXp1cmUgRmVkZXJhdGVkIFNTTyBDZXJ0aWZpY2F0ZTAeFw0yNDA1MDgwNDQwNDRaFw0yNzA1MDgwNDQwNDRaMDQxMjAwBgNVBAMTKU1pY3Jvc29mdCBBenVyZSBGZWRlcmF0ZWQgU1NPIENlcnRpZmljYXRlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyReHuW5fr1uvA/c7BJARso0zEWr+t1yodFguKyVkSq4xQ8HPGChfaknlZlvuYww75JS90b5nuXwcReHFMPBcZ8P6iCyb3etNYOetX37d3Lj+w14R8hPCxIkbG+r26OWI+Udoge/0gi/Uz24w8q3uy1R1d+gUQrTqafMA9WMBx/pOjjKvSHg/s2nLOv4WcWC1gCRTp12H2ppR9NP3KZ5FZXdJnw0Hvxi18ADIaV+tFvIvvluDaAqdYmGKFWAO1nEsrQjSWx3Lm0DMiiiRz7BcGy6OgVEmE6b8vXTuLO5fkmBc8d7OWdV4s6xyjQChDkN/TyXpTxiQ71TR+O6c1yE37QIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQAe7HVo787amjvc3Op0R45vC4YhDFR5N9v7A6AtUL0JvD4UxXofkUdEF7unRScLfrPKRlsW/ZT5y98WishA/sqZ/CXWHwP5G88xwZO2M+eeXpUfQFhJh1LFoFOhOnvs4aaJP2PC3Xyel72/zdGozut2hQIHrJ4ifYuUFTG5AXayJ1rTARkQ+GdRNezxE9BiyMs0EUIloAoNRu/EiTRXuTcnk1b3o1yi+ADvitrsH7JWkJm4f8b9Ydtbi1pJmk7Qy+ardZNVOuFh+ErX7/N9NMYA11EcJlqgdYja7uU/Y9sMKDIIE9h5sdUVou/zfZsukKCGzt1H16XMLZ610TwDgrcv \ No newline at end of file diff --git a/certificate.pem b/certificate.pem new file mode 100644 index 0000000..7f13d28 --- /dev/null +++ b/certificate.pem @@ -0,0 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VMD/C/SR8/Exk2JP0CDSAFd9PiIL5x7n1cdbJKTxpqxqUtu6R0 +MXgQJSU2tIz17B1NbIZ7GSCK7lajv93kZEfVOXvKxlVJpkaIkyUeH5wu4QwqOOh5 +uu1YTeEL3NkwabQ111J3j9loONm0WVQLc6jxo9Thl24mTNgl3vPlTg== +-----END CERTIFICATE----- diff --git a/node_modules/.bin/esparse b/node_modules/.bin/esparse new file mode 120000 index 0000000..7423b18 --- /dev/null +++ b/node_modules/.bin/esparse @@ -0,0 +1 @@ +../esprima/bin/esparse.js \ No newline at end of file diff --git a/node_modules/.bin/esvalidate b/node_modules/.bin/esvalidate new file mode 120000 index 0000000..16069ef --- /dev/null +++ b/node_modules/.bin/esvalidate @@ -0,0 +1 @@ +../esprima/bin/esvalidate.js \ No newline at end of file diff --git a/node_modules/.bin/js-yaml b/node_modules/.bin/js-yaml new file mode 120000 index 0000000..9dbd010 --- /dev/null +++ b/node_modules/.bin/js-yaml @@ -0,0 +1 @@ +../js-yaml/bin/js-yaml.js \ No newline at end of file diff --git a/node_modules/.bin/mime b/node_modules/.bin/mime new file mode 120000 index 0000000..fbb7ee0 --- /dev/null +++ b/node_modules/.bin/mime @@ -0,0 +1 @@ +../mime/cli.js \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 0000000..0b40d0b --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,884 @@ +{ + "name": "my-saml-project", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "node_modules/@oozcitak/dom": { + "version": "1.15.8", + "resolved": "https://registry.npmjs.org/@oozcitak/dom/-/dom-1.15.8.tgz", + "integrity": "sha512-MoOnLBNsF+ok0HjpAvxYxR4piUhRDCEWK0ot3upwOOHYudJd30j6M+LNcE8RKpwfnclAX9T66nXXzkytd29XSw==", + "dependencies": { + "@oozcitak/infra": "1.0.8", + "@oozcitak/url": "1.0.4", + "@oozcitak/util": "8.3.8" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/@oozcitak/infra": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@oozcitak/infra/-/infra-1.0.8.tgz", + "integrity": "sha512-JRAUc9VR6IGHOL7OGF+yrvs0LO8SlqGnPAMqyzOuFZPSZSXI7Xf2O9+awQPSMXgIWGtgUf/dA6Hs6X6ySEaWTg==", + "dependencies": { + "@oozcitak/util": "8.3.8" + }, + "engines": { + "node": ">=6.0" + } + }, + "node_modules/@oozcitak/url": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@oozcitak/url/-/url-1.0.4.tgz", + "integrity": "sha512-kDcD8y+y3FCSOvnBI6HJgl00viO/nGbQoCINmQ0h98OhnGITrWR3bOGfwYCthgcrV8AnTJz8MzslTQbC3SOAmw==", + "dependencies": { + "@oozcitak/infra": "1.0.8", + "@oozcitak/util": "8.3.8" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/@oozcitak/util": { + "version": "8.3.8", + "resolved": "https://registry.npmjs.org/@oozcitak/util/-/util-8.3.8.tgz", + "integrity": "sha512-T8TbSnGsxo6TDBJx/Sgv/BlVJL3tshxZP7Aq5R1mSnM5OcHY2dQaxLMu2+E8u3gN0MLOzdjurqN4ZRVuzQycOQ==", + "engines": { + "node": ">=8.0" + } + }, + "node_modules/@types/node": { + "version": "20.12.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.11.tgz", + "integrity": "sha512-vDg9PZ/zi+Nqp6boSOT7plNuthRugEKixDv5sFTIpkE89MmNtEArAShI4mxuX2+UrLEe9pxC1vm2cjm9YlWbJw==", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@xmldom/xmldom": { + "version": "0.8.10", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", + "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "node_modules/async": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", + "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==" + }, + "node_modules/body-parser": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.2", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.6.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/js-yaml": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", + "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-inspect": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/saml2-js": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/saml2-js/-/saml2-js-4.0.2.tgz", + "integrity": "sha512-03EEy/d55+4Ltl6jXAcRY1Fkrcpwt3K6a0T4N4Bfq5IKu9TbJqYG5AoXSi1P4lKvwvxQ99v5RPeoffSsumRrEg==", + "dependencies": { + "@xmldom/xmldom": "^0.8.6", + "async": "^3.2.0", + "debug": "^4.3.0", + "underscore": "^1.8.0", + "xml-crypto": "^3.0.1", + "xml-encryption": "^3.0.2", + "xmlbuilder2": "^2.4.0" + }, + "engines": { + "node": ">=10.x" + } + }, + "node_modules/saml2-js/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/saml2-js/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/side-channel": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/underscore": { + "version": "1.13.6", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", + "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==" + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/xml-crypto": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/xml-crypto/-/xml-crypto-3.2.0.tgz", + "integrity": "sha512-qVurBUOQrmvlgmZqIVBqmb06TD2a/PpEUfFPgD7BuBfjmoH4zgkqaWSIJrnymlCvM2GGt9x+XtJFA+ttoAufqg==", + "dependencies": { + "@xmldom/xmldom": "^0.8.8", + "xpath": "0.0.32" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/xml-encryption": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/xml-encryption/-/xml-encryption-3.0.2.tgz", + "integrity": "sha512-VxYXPvsWB01/aqVLd6ZMPWZ+qaj0aIdF+cStrVJMcFj3iymwZeI0ABzB3VqMYv48DkSpRhnrXqTUkR34j+UDyg==", + "dependencies": { + "@xmldom/xmldom": "^0.8.5", + "escape-html": "^1.0.3", + "xpath": "0.0.32" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/xmlbuilder2": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/xmlbuilder2/-/xmlbuilder2-2.4.1.tgz", + "integrity": "sha512-vliUplZsk5vJnhxXN/mRcij/AE24NObTUm/Zo4vkLusgayO6s3Et5zLEA14XZnY1c3hX5o1ToR0m0BJOPy0UvQ==", + "dependencies": { + "@oozcitak/dom": "1.15.8", + "@oozcitak/infra": "1.0.8", + "@oozcitak/util": "8.3.8", + "@types/node": "*", + "js-yaml": "3.14.0" + }, + "engines": { + "node": ">=10.0" + } + }, + "node_modules/xpath": { + "version": "0.0.32", + "resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.32.tgz", + "integrity": "sha512-rxMJhSIoiO8vXcWvSifKqhvV96GjiD5wYb8/QHdoRyQvraTpp4IEv944nhGausZZ3u7dhQXteZuZbaqfpB7uYw==", + "engines": { + "node": ">=0.6.0" + } + } + } +} diff --git a/node_modules/@oozcitak/dom/LICENSE b/node_modules/@oozcitak/dom/LICENSE new file mode 100644 index 0000000..eee50f6 --- /dev/null +++ b/node_modules/@oozcitak/dom/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Ozgur Ozcitak + +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. diff --git a/node_modules/@oozcitak/dom/README.md b/node_modules/@oozcitak/dom/README.md new file mode 100644 index 0000000..b302b05 --- /dev/null +++ b/node_modules/@oozcitak/dom/README.md @@ -0,0 +1,32 @@ +# DOM +A Javascript implementation of the [DOM Living Standard](https://dom.spec.whatwg.org/). + +[![License](http://img.shields.io/npm/l/@oozcitak/dom.svg?style=flat-square)](http://opensource.org/licenses/MIT) +[![NPM Version](https://img.shields.io/npm/v/@oozcitak/dom?logo=npm&style=flat-square)](https://www.npmjs.com/package/@oozcitak/dom) + +[![Travis Build Status](https://img.shields.io/travis/oozcitak/dom?logo=travis&style=flat-square)](http://travis-ci.org/oozcitak/dom) +[![AppVeyor Build status](https://img.shields.io/appveyor/ci/oozcitak/dom?logo=appveyor&style=flat-square)](https://ci.appveyor.com/project/oozcitak/dom) +[![Dev Dependency Status](http://img.shields.io/david/dev/oozcitak/dom.svg?style=flat-square)](https://david-dm.org/oozcitak/dom) +[![Code Coverage](https://img.shields.io/codecov/c/github/oozcitak/dom?logo=codecov&style=flat-square)](https://codecov.io/gh/oozcitak/dom) + +# Version +Current version implements the standard as of commit [57512fa](https://dom.spec.whatwg.org/commit-snapshots/57512fac17cf2f1c4c85be4aec178c8086ee5ee4/) (Last Updated 24 September 2019). + +This DOM implementation is for _XML documents only_. + +# Installation +``` +npm install @oozcitak/dom +``` + +# Usage +Create an instance of the [`DOMImplementation`](https://dom.spec.whatwg.org/#interface-domimplementation) class to construct the DOM tree. + +```js +const { DOMImplementation } = require("@oozcitak/dom"); + +const dom = new DOMImplementation(); +const doc = dom.createDocument('ns', 'root'); +``` + +The module also exports [`DOMParser`](https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparser) and [`XMLSerializer`](https://w3c.github.io/DOM-Parsing/#the-xmlserializer-interface) classes as in the browser. diff --git a/node_modules/@oozcitak/dom/lib/algorithm/AbortAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/AbortAlgorithm.d.ts new file mode 100644 index 0000000..c96e395 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/AbortAlgorithm.d.ts @@ -0,0 +1,21 @@ +import { AbortSignal } from "../dom/interfaces"; +/** + * Adds an algorithm to the given abort signal. + * + * @param algorithm - an algorithm + * @param signal - abort signal + */ +export declare function abort_add(algorithm: ((...args: any[]) => any), signal: AbortSignal): void; +/** + * Removes an algorithm from the given abort signal. + * + * @param algorithm - an algorithm + * @param signal - abort signal + */ +export declare function abort_remove(algorithm: ((...args: any[]) => any), signal: AbortSignal): void; +/** + * Signals abort on the given abort signal. + * + * @param signal - abort signal + */ +export declare function abort_signalAbort(signal: AbortSignal): void; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/AbortAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/AbortAlgorithm.js new file mode 100644 index 0000000..94614d6 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/AbortAlgorithm.js @@ -0,0 +1,79 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var EventAlgorithm_1 = require("./EventAlgorithm"); +/** + * Adds an algorithm to the given abort signal. + * + * @param algorithm - an algorithm + * @param signal - abort signal + */ +function abort_add(algorithm, signal) { + /** + * 1. If signal’s aborted flag is set, then return. + * 2. Append algorithm to signal’s abort algorithms. + */ + if (signal._abortedFlag) + return; + signal._abortAlgorithms.add(algorithm); +} +exports.abort_add = abort_add; +/** + * Removes an algorithm from the given abort signal. + * + * @param algorithm - an algorithm + * @param signal - abort signal + */ +function abort_remove(algorithm, signal) { + /** + * To remove an algorithm algorithm from an AbortSignal signal, remove + * algorithm from signal’s abort algorithms. + */ + signal._abortAlgorithms.delete(algorithm); +} +exports.abort_remove = abort_remove; +/** + * Signals abort on the given abort signal. + * + * @param signal - abort signal + */ +function abort_signalAbort(signal) { + var e_1, _a; + /** + * 1. If signal’s aborted flag is set, then return. + * 2. Set signal’s aborted flag. + * 3. For each algorithm in signal’s abort algorithms: run algorithm. + * 4. Empty signal’s abort algorithms. + * 5. Fire an event named abort at signal. + */ + if (signal._abortedFlag) + return; + signal._abortedFlag = true; + try { + for (var _b = __values(signal._abortAlgorithms), _c = _b.next(); !_c.done; _c = _b.next()) { + var algorithm = _c.value; + algorithm.call(signal); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + signal._abortAlgorithms.clear(); + EventAlgorithm_1.event_fireAnEvent("abort", signal); +} +exports.abort_signalAbort = abort_signalAbort; +//# sourceMappingURL=AbortAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/AbortAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/AbortAlgorithm.js.map new file mode 100644 index 0000000..9954d1f --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/AbortAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AbortAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/AbortAlgorithm.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,mDAAoD;AAEpD;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,SAAoC,EAAE,MAAmB;IACjF;;;OAGG;IACH,IAAI,MAAM,CAAC,YAAY;QAAE,OAAM;IAC/B,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;AACxC,CAAC;AAPD,8BAOC;AAED;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,SAAoC,EAAE,MAAmB;IACpF;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;AAC3C,CAAC;AAND,oCAMC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,MAAmB;;IACnD;;;;;;OAMG;IACH,IAAI,MAAM,CAAC,YAAY;QAAE,OAAM;IAC/B,MAAM,CAAC,YAAY,GAAG,IAAI,CAAA;;QAC1B,KAAwB,IAAA,KAAA,SAAA,MAAM,CAAC,gBAAgB,CAAA,gBAAA,4BAAE;YAA5C,IAAM,SAAS,WAAA;YAClB,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;SACvB;;;;;;;;;IACD,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAA;IAC/B,kCAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AACpC,CAAC;AAfD,8CAeC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/AttrAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/AttrAlgorithm.d.ts new file mode 100644 index 0000000..3288e80 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/AttrAlgorithm.d.ts @@ -0,0 +1,8 @@ +import { Attr } from "../dom/interfaces"; +/** + * Changes the value of an existing attribute. + * + * @param attribute - an attribute node + * @param value - attribute value + */ +export declare function attr_setAnExistingAttributeValue(attribute: Attr, value: string): void; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/AttrAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/AttrAlgorithm.js new file mode 100644 index 0000000..6dc6f10 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/AttrAlgorithm.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var ElementAlgorithm_1 = require("./ElementAlgorithm"); +/** + * Changes the value of an existing attribute. + * + * @param attribute - an attribute node + * @param value - attribute value + */ +function attr_setAnExistingAttributeValue(attribute, value) { + /** + * 1. If attribute’s element is null, then set attribute’s value to value. + * 2. Otherwise, change attribute from attribute’s element to value. + */ + if (attribute._element === null) { + attribute._value = value; + } + else { + ElementAlgorithm_1.element_change(attribute, attribute._element, value); + } +} +exports.attr_setAnExistingAttributeValue = attr_setAnExistingAttributeValue; +//# sourceMappingURL=AttrAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/AttrAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/AttrAlgorithm.js.map new file mode 100644 index 0000000..8f19893 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/AttrAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AttrAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/AttrAlgorithm.ts"],"names":[],"mappings":";;AACA,uDAAmD;AAEnD;;;;;GAKG;AACH,SAAgB,gCAAgC,CAAC,SAAe,EAAE,KAAa;IAC7E;;;OAGG;IACH,IAAI,SAAS,CAAC,QAAQ,KAAK,IAAI,EAAE;QAC/B,SAAS,CAAC,MAAM,GAAG,KAAK,CAAA;KACzB;SAAM;QACL,iCAAc,CAAC,SAAS,EAAE,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;KACrD;AACH,CAAC;AAVD,4EAUC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/BoundaryPointAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/BoundaryPointAlgorithm.d.ts new file mode 100644 index 0000000..cdff768 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/BoundaryPointAlgorithm.d.ts @@ -0,0 +1,8 @@ +import { BoundaryPoint, BoundaryPosition } from "../dom/interfaces"; +/** + * Defines the position of a boundary point relative to another. + * + * @param bp - a boundary point + * @param relativeTo - a boundary point to compare to + */ +export declare function boundaryPoint_position(bp: BoundaryPoint, relativeTo: BoundaryPoint): BoundaryPosition; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/BoundaryPointAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/BoundaryPointAlgorithm.js new file mode 100644 index 0000000..83e10de --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/BoundaryPointAlgorithm.js @@ -0,0 +1,76 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("../dom/interfaces"); +var TreeAlgorithm_1 = require("./TreeAlgorithm"); +/** + * Defines the position of a boundary point relative to another. + * + * @param bp - a boundary point + * @param relativeTo - a boundary point to compare to + */ +function boundaryPoint_position(bp, relativeTo) { + var nodeA = bp[0]; + var offsetA = bp[1]; + var nodeB = relativeTo[0]; + var offsetB = relativeTo[1]; + /** + * 1. Assert: nodeA and nodeB have the same root. + */ + console.assert(TreeAlgorithm_1.tree_rootNode(nodeA) === TreeAlgorithm_1.tree_rootNode(nodeB), "Boundary points must share the same root node."); + /** + * 2. If nodeA is nodeB, then return equal if offsetA is offsetB, before + * if offsetA is less than offsetB, and after if offsetA is greater than + * offsetB. + */ + if (nodeA === nodeB) { + if (offsetA === offsetB) { + return interfaces_1.BoundaryPosition.Equal; + } + else if (offsetA < offsetB) { + return interfaces_1.BoundaryPosition.Before; + } + else { + return interfaces_1.BoundaryPosition.After; + } + } + /** + * 3. If nodeA is following nodeB, then if the position of (nodeB, offsetB) + * relative to (nodeA, offsetA) is before, return after, and if it is after, + * return before. + */ + if (TreeAlgorithm_1.tree_isFollowing(nodeB, nodeA)) { + var pos = boundaryPoint_position([nodeB, offsetB], [nodeA, offsetA]); + if (pos === interfaces_1.BoundaryPosition.Before) { + return interfaces_1.BoundaryPosition.After; + } + else if (pos === interfaces_1.BoundaryPosition.After) { + return interfaces_1.BoundaryPosition.Before; + } + } + /** + * 4. If nodeA is an ancestor of nodeB: + */ + if (TreeAlgorithm_1.tree_isAncestorOf(nodeB, nodeA)) { + /** + * 4.1. Let child be nodeB. + * 4.2. While child is not a child of nodeA, set child to its parent. + * 4.3. If child’s index is less than offsetA, then return after. + */ + var child = nodeB; + while (!TreeAlgorithm_1.tree_isChildOf(nodeA, child)) { + /* istanbul ignore else */ + if (child._parent !== null) { + child = child._parent; + } + } + if (TreeAlgorithm_1.tree_index(child) < offsetA) { + return interfaces_1.BoundaryPosition.After; + } + } + /** + * 5. Return before. + */ + return interfaces_1.BoundaryPosition.Before; +} +exports.boundaryPoint_position = boundaryPoint_position; +//# sourceMappingURL=BoundaryPointAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/BoundaryPointAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/BoundaryPointAlgorithm.js.map new file mode 100644 index 0000000..6749cc7 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/BoundaryPointAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"BoundaryPointAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/BoundaryPointAlgorithm.ts"],"names":[],"mappings":";;AAAA,gDAAmE;AACnE,iDAGwB;AAExB;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,EAAiB,EAAE,UAAyB;IAEjF,IAAM,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;IACnB,IAAM,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;IACrB,IAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;IAC3B,IAAM,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;IAE7B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,6BAAa,CAAC,KAAK,CAAC,KAAK,6BAAa,CAAC,KAAK,CAAC,EAC1D,gDAAgD,CAAC,CAAA;IAEnD;;;;OAIG;IACH,IAAI,KAAK,KAAK,KAAK,EAAE;QACnB,IAAI,OAAO,KAAK,OAAO,EAAE;YACvB,OAAO,6BAAgB,CAAC,KAAK,CAAA;SAC9B;aAAM,IAAI,OAAO,GAAG,OAAO,EAAE;YAC5B,OAAO,6BAAgB,CAAC,MAAM,CAAA;SAC/B;aAAM;YACL,OAAO,6BAAgB,CAAC,KAAK,CAAA;SAC9B;KACF;IAED;;;;OAIG;IACH,IAAI,gCAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;QAClC,IAAM,GAAG,GAAG,sBAAsB,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;QACtE,IAAI,GAAG,KAAK,6BAAgB,CAAC,MAAM,EAAE;YACnC,OAAO,6BAAgB,CAAC,KAAK,CAAA;SAC9B;aAAM,IAAI,GAAG,KAAK,6BAAgB,CAAC,KAAK,EAAE;YACzC,OAAO,6BAAgB,CAAC,MAAM,CAAA;SAC/B;KACF;IAED;;OAEG;IACH,IAAI,iCAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;QACnC;;;;WAIG;QACH,IAAI,KAAK,GAAG,KAAK,CAAA;QAEjB,OAAO,CAAC,8BAAc,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;YACpC,0BAA0B;YAC1B,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI,EAAE;gBAC1B,KAAK,GAAG,KAAK,CAAC,OAAO,CAAA;aACtB;SACF;QAED,IAAI,0BAAU,CAAC,KAAK,CAAC,GAAG,OAAO,EAAE;YAC/B,OAAO,6BAAgB,CAAC,KAAK,CAAA;SAC9B;KACF;IAED;;OAEG;IACH,OAAO,6BAAgB,CAAC,MAAM,CAAA;AAChC,CAAC;AArED,wDAqEC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/CharacterDataAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/CharacterDataAlgorithm.d.ts new file mode 100644 index 0000000..255b8f6 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/CharacterDataAlgorithm.d.ts @@ -0,0 +1,19 @@ +import { CharacterData } from "../dom/interfaces"; +/** + * Replaces character data. + * + * @param node - a character data node + * @param offset - start offset + * @param count - count of characters to replace + * @param data - new data + */ +export declare function characterData_replaceData(node: CharacterData, offset: number, count: number, data: string): void; +/** + * Returns `count` number of characters from `node`'s data starting at + * the given `offset`. + * + * @param node - a character data node + * @param offset - start offset + * @param count - count of characters to return + */ +export declare function characterData_substringData(node: CharacterData, offset: number, count: number): string; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/CharacterDataAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/CharacterDataAlgorithm.js new file mode 100644 index 0000000..83a7f40 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/CharacterDataAlgorithm.js @@ -0,0 +1,140 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("../dom/DOMImpl"); +var util_1 = require("../util"); +var DOMException_1 = require("../dom/DOMException"); +var TreeAlgorithm_1 = require("./TreeAlgorithm"); +var MutationObserverAlgorithm_1 = require("./MutationObserverAlgorithm"); +var DOMAlgorithm_1 = require("./DOMAlgorithm"); +/** + * Replaces character data. + * + * @param node - a character data node + * @param offset - start offset + * @param count - count of characters to replace + * @param data - new data + */ +function characterData_replaceData(node, offset, count, data) { + var e_1, _a; + /** + * 1. Let length be node’s length. + * 2. If offset is greater than length, then throw an "IndexSizeError" + * DOMException. + * 3. If offset plus count is greater than length, then set count to length + * minus offset. + */ + var length = TreeAlgorithm_1.tree_nodeLength(node); + if (offset > length) { + throw new DOMException_1.IndexSizeError("Offset exceeds character data length. Offset: " + offset + ", Length: " + length + ", Node is " + node.nodeName + "."); + } + if (offset + count > length) { + count = length - offset; + } + /** + * 4. Queue a mutation record of "characterData" for node with null, null, + * node’s data, « », « », null, and null. + */ + if (DOMImpl_1.dom.features.mutationObservers) { + MutationObserverAlgorithm_1.observer_queueMutationRecord("characterData", node, null, null, node._data, [], [], null, null); + } + /** + * 5. Insert data into node’s data after offset code units. + * 6. Let delete offset be offset + data’s length. + * 7. Starting from delete offset code units, remove count code units from + * node’s data. + */ + var newData = node._data.substring(0, offset) + data + + node._data.substring(offset + count); + node._data = newData; + try { + /** + * 8. For each live range whose start node is node and start offset is + * greater than offset but less than or equal to offset plus count, set its + * start offset to offset. + * 9. For each live range whose end node is node and end offset is greater + * than offset but less than or equal to offset plus count, set its end + * offset to offset. + * 10. For each live range whose start node is node and start offset is + * greater than offset plus count, increase its start offset by data’s + * length and decrease it by count. + * 11. For each live range whose end node is node and end offset is greater + * than offset plus count, increase its end offset by data’s length and + * decrease it by count. + */ + for (var _b = __values(DOMImpl_1.dom.rangeList), _c = _b.next(); !_c.done; _c = _b.next()) { + var range = _c.value; + if (range._start[0] === node && range._start[1] > offset && range._start[1] <= offset + count) { + range._start[1] = offset; + } + if (range._end[0] === node && range._end[1] > offset && range._end[1] <= offset + count) { + range._end[1] = offset; + } + if (range._start[0] === node && range._start[1] > offset + count) { + range._start[1] += data.length - count; + } + if (range._end[0] === node && range._end[1] > offset + count) { + range._end[1] += data.length - count; + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + /** + * 12. If node is a Text node and its parent is not null, run the child + * text content change steps for node’s parent. + */ + if (DOMImpl_1.dom.features.steps) { + if (util_1.Guard.isTextNode(node) && node._parent !== null) { + DOMAlgorithm_1.dom_runChildTextContentChangeSteps(node._parent); + } + } +} +exports.characterData_replaceData = characterData_replaceData; +/** + * Returns `count` number of characters from `node`'s data starting at + * the given `offset`. + * + * @param node - a character data node + * @param offset - start offset + * @param count - count of characters to return + */ +function characterData_substringData(node, offset, count) { + /** + * 1. Let length be node’s length. + * 2. If offset is greater than length, then throw an "IndexSizeError" + * DOMException. + * 3. If offset plus count is greater than length, return a string whose + * value is the code units from the offsetth code unit to the end of node’s + * data, and then return. + * 4. Return a string whose value is the code units from the offsetth code + * unit to the offset+countth code unit in node’s data. + */ + var length = TreeAlgorithm_1.tree_nodeLength(node); + if (offset > length) { + throw new DOMException_1.IndexSizeError("Offset exceeds character data length. Offset: " + offset + ", Length: " + length + ", Node is " + node.nodeName + "."); + } + if (offset + count > length) { + return node._data.substr(offset); + } + else { + return node._data.substr(offset, count); + } +} +exports.characterData_substringData = characterData_substringData; +//# sourceMappingURL=CharacterDataAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/CharacterDataAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/CharacterDataAlgorithm.js.map new file mode 100644 index 0000000..e693b9e --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/CharacterDataAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CharacterDataAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/CharacterDataAlgorithm.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,0CAAoC;AAEpC,gCAA+B;AAC/B,oDAAoD;AACpD,iDAAiD;AACjD,yEAA0E;AAC1E,+CAAmE;AAEnE;;;;;;;GAOG;AACH,SAAgB,yBAAyB,CAAC,IAAmB,EAAE,MAAc,EAAE,KAAa,EAC1F,IAAY;;IAEZ;;;;;;OAMG;IACH,IAAM,MAAM,GAAG,+BAAe,CAAC,IAAI,CAAC,CAAA;IAEpC,IAAI,MAAM,GAAG,MAAM,EAAE;QACnB,MAAM,IAAI,6BAAc,CAAC,mDAAiD,MAAM,kBAAa,MAAM,kBAAa,IAAI,CAAC,QAAQ,MAAG,CAAC,CAAA;KAClI;IAED,IAAI,MAAM,GAAG,KAAK,GAAG,MAAM,EAAE;QAC3B,KAAK,GAAG,MAAM,GAAG,MAAM,CAAA;KACxB;IAED;;;OAGG;IACH,IAAI,aAAG,CAAC,QAAQ,CAAC,iBAAiB,EAAE;QAClC,wDAA4B,CAAC,eAAe,EA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AAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,KAAK,EAAE;gBAC5D,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;aACrC;SACF;;;;;;;;;IAED;;;OAGG;IACH,IAAI,aAAG,CAAC,QAAQ,CAAC,KAAK,EAAE;QACtB,IAAI,YAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE;YACnD,iDAAkC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;SACjD;KACF;AACH,CAAC;AA7ED,8DA6EC;AAED;;;;;;;GAOG;AACH,SAAgB,2BAA2B,CAAC,IAAmB,EAAE,MAAc,EAAE,KAAa;IAC5F;;;;;;;;;OASG;IACH,IAAM,MAAM,GAAG,+BAAe,CAAC,IAAI,CAAC,CAAA;IAEpC,IAAI,MAAM,GAAG,MAAM,EAAE;QACnB,MAAM,IAAI,6BAAc,CAAC,mDAAiD,MAAM,kBAAa,MAAM,kBAAa,IAAI,CAAC,QAAQ,MAAG,CAAC,CAAA;KAClI;IAED,IAAI,MAAM,GAAG,KAAK,GAAG,MAAM,EAAE;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;KACjC;SAAM;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;KACxC;AACH,CAAC;AAtBD,kEAsBC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/CreateAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/CreateAlgorithm.d.ts new file mode 100644 index 0000000..2ecceb7 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/CreateAlgorithm.d.ts @@ -0,0 +1,192 @@ +import { Document, DOMImplementation, Window, XMLDocument, AbortController, AbortSignal, DocumentType, Element, DocumentFragment, ShadowRoot, Attr, Text, CDATASection, Comment, ProcessingInstruction, Node, HTMLCollection, NodeList, NamedNodeMap, BoundaryPoint, Range, NodeIterator, TreeWalker, NodeFilter, MutationRecord, DOMTokenList } from "../dom/interfaces"; +/** + * Creates a `DOMImplementation`. + * + * @param document - associated document + */ +export declare function create_domImplementation(document: Document): DOMImplementation; +/** + * Creates a `Window` node. + */ +export declare function create_window(): Window; +/** + * Creates an `XMLDocument` node. + */ +export declare function create_xmlDocument(): XMLDocument; +/** + * Creates a `Document` node. + */ +export declare function create_document(): Document; +/** + * Creates an `AbortController`. + */ +export declare function create_abortController(): AbortController; +/** + * Creates an `AbortSignal`. + */ +export declare function create_abortSignal(): AbortSignal; +/** + * Creates a `DocumentType` node. + * + * @param document - owner document + * @param name - name of the node + * @param publicId - `PUBLIC` identifier + * @param systemId - `SYSTEM` identifier + */ +export declare function create_documentType(document: Document, name: string, publicId: string, systemId: string): DocumentType; +/** + * Creates a new `Element` node. + * + * @param document - owner document + * @param localName - local name + * @param namespace - namespace + * @param prefix - namespace prefix + */ +export declare function create_element(document: Document, localName: string, namespace: string | null, prefix: string | null): Element; +/** + * Creates a new `HTMLElement` node. + * + * @param document - owner document + * @param localName - local name + * @param namespace - namespace + * @param prefix - namespace prefix + */ +export declare function create_htmlElement(document: Document, localName: string, namespace: string | null, prefix: string | null): Element; +/** + * Creates a new `HTMLUnknownElement` node. + * + * @param document - owner document + * @param localName - local name + * @param namespace - namespace + * @param prefix - namespace prefix + */ +export declare function create_htmlUnknownElement(document: Document, localName: string, namespace: string | null, prefix: string | null): Element; +/** + * Creates a new `DocumentFragment` node. + * + * @param document - owner document + */ +export declare function create_documentFragment(document: Document): DocumentFragment; +/** + * Creates a new `ShadowRoot` node. + * + * @param document - owner document + * @param host - shadow root's host element node + */ +export declare function create_shadowRoot(document: Document, host: Element): ShadowRoot; +/** + * Creates a new `Attr` node. + * + * @param document - owner document + * @param localName - local name + */ +export declare function create_attr(document: Document, localName: string): Attr; +/** + * Creates a new `Text` node. + * + * @param document - owner document + * @param data - node contents + */ +export declare function create_text(document: Document, data: string): Text; +/** + * Creates a new `CDATASection` node. + * + * @param document - owner document + * @param data - node contents + */ +export declare function create_cdataSection(document: Document, data: string): CDATASection; +/** + * Creates a new `Comment` node. + * + * @param document - owner document + * @param data - node contents + */ +export declare function create_comment(document: Document, data: string): Comment; +/** + * Creates a new `ProcessingInstruction` node. + * + * @param document - owner document + * @param target - instruction target + * @param data - node contents + */ +export declare function create_processingInstruction(document: Document, target: string, data: string): ProcessingInstruction; +/** + * Creates a new `HTMLCollection`. + * + * @param root - root node + * @param filter - node filter + */ +export declare function create_htmlCollection(root: Node, filter?: ((element: Element) => any)): HTMLCollection; +/** + * Creates a new live `NodeList`. + * + * @param root - root node + */ +export declare function create_nodeList(root: Node): NodeList; +/** + * Creates a new static `NodeList`. + * + * @param root - root node + * @param items - a list of items to initialize the list + */ +export declare function create_nodeListStatic(root: Node, items: Node[]): NodeList; +/** + * Creates a new `NamedNodeMap`. + * + * @param element - parent element + */ +export declare function create_namedNodeMap(element: Element): NamedNodeMap; +/** + * Creates a new `Range`. + * + * @param start - start point + * @param end - end point + */ +export declare function create_range(start?: BoundaryPoint, end?: BoundaryPoint): Range; +/** + * Creates a new `NodeIterator`. + * + * @param root - iterator's root node + * @param reference - reference node + * @param pointerBeforeReference - whether the iterator is before or after the + * reference node + */ +export declare function create_nodeIterator(root: Node, reference: Node, pointerBeforeReference: boolean): NodeIterator; +/** + * Creates a new `TreeWalker`. + * + * @param root - iterator's root node + * @param current - current node + */ +export declare function create_treeWalker(root: Node, current: Node): TreeWalker; +/** + * Creates a new `NodeFilter`. + */ +export declare function create_nodeFilter(): NodeFilter; +/** + * Creates a new `MutationRecord`. + * + * @param type - type of mutation: `"attributes"` for an attribute + * mutation, `"characterData"` for a mutation to a CharacterData node + * and `"childList"` for a mutation to the tree of nodes. + * @param target - node affected by the mutation. + * @param addedNodes - list of added nodes. + * @param removedNodes - list of removed nodes. + * @param previousSibling - previous sibling of added or removed nodes. + * @param nextSibling - next sibling of added or removed nodes. + * @param attributeName - local name of the changed attribute, + * and `null` otherwise. + * @param attributeNamespace - namespace of the changed attribute, + * and `null` otherwise. + * @param oldValue - value before mutation: attribute value for an attribute + * mutation, node `data` for a mutation to a CharacterData node and `null` + * for a mutation to the tree of nodes. + */ +export declare function create_mutationRecord(type: "attributes" | "characterData" | "childList", target: Node, addedNodes: NodeList, removedNodes: NodeList, previousSibling: Node | null, nextSibling: Node | null, attributeName: string | null, attributeNamespace: string | null, oldValue: string | null): MutationRecord; +/** + * Creates a new `DOMTokenList`. + * + * @param element - associated element + * @param attribute - associated attribute + */ +export declare function create_domTokenList(element: Element, attribute: Attr): DOMTokenList; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/CreateAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/CreateAlgorithm.js new file mode 100644 index 0000000..425b3df --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/CreateAlgorithm.js @@ -0,0 +1,303 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImplementationImpl_1 = require("../dom/DOMImplementationImpl"); +var WindowImpl_1 = require("../dom/WindowImpl"); +var XMLDocumentImpl_1 = require("../dom/XMLDocumentImpl"); +var DocumentImpl_1 = require("../dom/DocumentImpl"); +var AbortControllerImpl_1 = require("../dom/AbortControllerImpl"); +var AbortSignalImpl_1 = require("../dom/AbortSignalImpl"); +var DocumentTypeImpl_1 = require("../dom/DocumentTypeImpl"); +var ElementImpl_1 = require("../dom/ElementImpl"); +var DocumentFragmentImpl_1 = require("../dom/DocumentFragmentImpl"); +var ShadowRootImpl_1 = require("../dom/ShadowRootImpl"); +var AttrImpl_1 = require("../dom/AttrImpl"); +var TextImpl_1 = require("../dom/TextImpl"); +var CDATASectionImpl_1 = require("../dom/CDATASectionImpl"); +var CommentImpl_1 = require("../dom/CommentImpl"); +var ProcessingInstructionImpl_1 = require("../dom/ProcessingInstructionImpl"); +var HTMLCollectionImpl_1 = require("../dom/HTMLCollectionImpl"); +var NodeListImpl_1 = require("../dom/NodeListImpl"); +var NodeListStaticImpl_1 = require("../dom/NodeListStaticImpl"); +var NamedNodeMapImpl_1 = require("../dom/NamedNodeMapImpl"); +var RangeImpl_1 = require("../dom/RangeImpl"); +var NodeIteratorImpl_1 = require("../dom/NodeIteratorImpl"); +var TreeWalkerImpl_1 = require("../dom/TreeWalkerImpl"); +var NodeFilterImpl_1 = require("../dom/NodeFilterImpl"); +var MutationRecordImpl_1 = require("../dom/MutationRecordImpl"); +var DOMTokenListImpl_1 = require("../dom/DOMTokenListImpl"); +/** + * Creates a `DOMImplementation`. + * + * @param document - associated document + */ +function create_domImplementation(document) { + return DOMImplementationImpl_1.DOMImplementationImpl._create(document); +} +exports.create_domImplementation = create_domImplementation; +/** + * Creates a `Window` node. + */ +function create_window() { + return WindowImpl_1.WindowImpl._create(); +} +exports.create_window = create_window; +/** + * Creates an `XMLDocument` node. + */ +function create_xmlDocument() { + return new XMLDocumentImpl_1.XMLDocumentImpl(); +} +exports.create_xmlDocument = create_xmlDocument; +/** + * Creates a `Document` node. + */ +function create_document() { + return new DocumentImpl_1.DocumentImpl(); +} +exports.create_document = create_document; +/** + * Creates an `AbortController`. + */ +function create_abortController() { + return new AbortControllerImpl_1.AbortControllerImpl(); +} +exports.create_abortController = create_abortController; +/** + * Creates an `AbortSignal`. + */ +function create_abortSignal() { + return AbortSignalImpl_1.AbortSignalImpl._create(); +} +exports.create_abortSignal = create_abortSignal; +/** + * Creates a `DocumentType` node. + * + * @param document - owner document + * @param name - name of the node + * @param publicId - `PUBLIC` identifier + * @param systemId - `SYSTEM` identifier + */ +function create_documentType(document, name, publicId, systemId) { + return DocumentTypeImpl_1.DocumentTypeImpl._create(document, name, publicId, systemId); +} +exports.create_documentType = create_documentType; +/** + * Creates a new `Element` node. + * + * @param document - owner document + * @param localName - local name + * @param namespace - namespace + * @param prefix - namespace prefix + */ +function create_element(document, localName, namespace, prefix) { + return ElementImpl_1.ElementImpl._create(document, localName, namespace, prefix); +} +exports.create_element = create_element; +/** + * Creates a new `HTMLElement` node. + * + * @param document - owner document + * @param localName - local name + * @param namespace - namespace + * @param prefix - namespace prefix + */ +function create_htmlElement(document, localName, namespace, prefix) { + // TODO: Implement in HTML DOM + return ElementImpl_1.ElementImpl._create(document, localName, namespace, prefix); +} +exports.create_htmlElement = create_htmlElement; +/** + * Creates a new `HTMLUnknownElement` node. + * + * @param document - owner document + * @param localName - local name + * @param namespace - namespace + * @param prefix - namespace prefix + */ +function create_htmlUnknownElement(document, localName, namespace, prefix) { + // TODO: Implement in HTML DOM + return ElementImpl_1.ElementImpl._create(document, localName, namespace, prefix); +} +exports.create_htmlUnknownElement = create_htmlUnknownElement; +/** + * Creates a new `DocumentFragment` node. + * + * @param document - owner document + */ +function create_documentFragment(document) { + return DocumentFragmentImpl_1.DocumentFragmentImpl._create(document); +} +exports.create_documentFragment = create_documentFragment; +/** + * Creates a new `ShadowRoot` node. + * + * @param document - owner document + * @param host - shadow root's host element node + */ +function create_shadowRoot(document, host) { + return ShadowRootImpl_1.ShadowRootImpl._create(document, host); +} +exports.create_shadowRoot = create_shadowRoot; +/** + * Creates a new `Attr` node. + * + * @param document - owner document + * @param localName - local name + */ +function create_attr(document, localName) { + return AttrImpl_1.AttrImpl._create(document, localName); +} +exports.create_attr = create_attr; +/** + * Creates a new `Text` node. + * + * @param document - owner document + * @param data - node contents + */ +function create_text(document, data) { + return TextImpl_1.TextImpl._create(document, data); +} +exports.create_text = create_text; +/** + * Creates a new `CDATASection` node. + * + * @param document - owner document + * @param data - node contents + */ +function create_cdataSection(document, data) { + return CDATASectionImpl_1.CDATASectionImpl._create(document, data); +} +exports.create_cdataSection = create_cdataSection; +/** + * Creates a new `Comment` node. + * + * @param document - owner document + * @param data - node contents + */ +function create_comment(document, data) { + return CommentImpl_1.CommentImpl._create(document, data); +} +exports.create_comment = create_comment; +/** + * Creates a new `ProcessingInstruction` node. + * + * @param document - owner document + * @param target - instruction target + * @param data - node contents + */ +function create_processingInstruction(document, target, data) { + return ProcessingInstructionImpl_1.ProcessingInstructionImpl._create(document, target, data); +} +exports.create_processingInstruction = create_processingInstruction; +/** + * Creates a new `HTMLCollection`. + * + * @param root - root node + * @param filter - node filter + */ +function create_htmlCollection(root, filter) { + if (filter === void 0) { filter = (function () { return true; }); } + return HTMLCollectionImpl_1.HTMLCollectionImpl._create(root, filter); +} +exports.create_htmlCollection = create_htmlCollection; +/** + * Creates a new live `NodeList`. + * + * @param root - root node + */ +function create_nodeList(root) { + return NodeListImpl_1.NodeListImpl._create(root); +} +exports.create_nodeList = create_nodeList; +/** + * Creates a new static `NodeList`. + * + * @param root - root node + * @param items - a list of items to initialize the list + */ +function create_nodeListStatic(root, items) { + return NodeListStaticImpl_1.NodeListStaticImpl._create(root, items); +} +exports.create_nodeListStatic = create_nodeListStatic; +/** + * Creates a new `NamedNodeMap`. + * + * @param element - parent element + */ +function create_namedNodeMap(element) { + return NamedNodeMapImpl_1.NamedNodeMapImpl._create(element); +} +exports.create_namedNodeMap = create_namedNodeMap; +/** + * Creates a new `Range`. + * + * @param start - start point + * @param end - end point + */ +function create_range(start, end) { + return RangeImpl_1.RangeImpl._create(start, end); +} +exports.create_range = create_range; +/** + * Creates a new `NodeIterator`. + * + * @param root - iterator's root node + * @param reference - reference node + * @param pointerBeforeReference - whether the iterator is before or after the + * reference node + */ +function create_nodeIterator(root, reference, pointerBeforeReference) { + return NodeIteratorImpl_1.NodeIteratorImpl._create(root, reference, pointerBeforeReference); +} +exports.create_nodeIterator = create_nodeIterator; +/** + * Creates a new `TreeWalker`. + * + * @param root - iterator's root node + * @param current - current node + */ +function create_treeWalker(root, current) { + return TreeWalkerImpl_1.TreeWalkerImpl._create(root, current); +} +exports.create_treeWalker = create_treeWalker; +/** + * Creates a new `NodeFilter`. + */ +function create_nodeFilter() { + return NodeFilterImpl_1.NodeFilterImpl._create(); +} +exports.create_nodeFilter = create_nodeFilter; +/** + * Creates a new `MutationRecord`. + * + * @param type - type of mutation: `"attributes"` for an attribute + * mutation, `"characterData"` for a mutation to a CharacterData node + * and `"childList"` for a mutation to the tree of nodes. + * @param target - node affected by the mutation. + * @param addedNodes - list of added nodes. + * @param removedNodes - list of removed nodes. + * @param previousSibling - previous sibling of added or removed nodes. + * @param nextSibling - next sibling of added or removed nodes. + * @param attributeName - local name of the changed attribute, + * and `null` otherwise. + * @param attributeNamespace - namespace of the changed attribute, + * and `null` otherwise. + * @param oldValue - value before mutation: attribute value for an attribute + * mutation, node `data` for a mutation to a CharacterData node and `null` + * for a mutation to the tree of nodes. + */ +function create_mutationRecord(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue) { + return MutationRecordImpl_1.MutationRecordImpl._create(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue); +} +exports.create_mutationRecord = create_mutationRecord; +/** + * Creates a new `DOMTokenList`. + * + * @param element - associated element + * @param attribute - associated attribute + */ +function create_domTokenList(element, attribute) { + return DOMTokenListImpl_1.DOMTokenListImpl._create(element, attribute); +} +exports.create_domTokenList = create_domTokenList; +//# sourceMappingURL=CreateAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/CreateAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/CreateAlgorithm.js.map new file mode 100644 index 0000000..621a96a --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/CreateAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CreateAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/CreateAlgorithm.ts"],"names":[],"mappings":";;AAOA,sEAAoE;AACpE,gDAA8C;AAC9C,0DAAwD;AACxD,oDAAkD;AAClD,kEAAgE;AAChE,0DAAwD;AACxD,4DAA0D;AAC1D,kDAAgD;AAChD,oEAAkE;AAClE,wDAAsD;AACtD,4CAA0C;AAC1C,4CAA0C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IAAI,EAAE,SAAS,EAAE,sBAAsB,CAAC,CAAA;AAC1E,CAAC;AAHD,kDAGC;AAED;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,IAAU,EAAE,OAAa;IACzD,OAAO,+BAAc,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;AAC9C,CAAC;AAFD,8CAEC;AAED;;GAEG;AACH,SAAgB,iBAAiB;IAC/B,OAAO,+BAAc,CAAC,OAAO,EAAE,CAAA;AACjC,CAAC;AAFD,8CAEC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,qBAAqB,CAAC,IAAkD,EACtF,MAAY,EAAE,UAAoB,EAClC,YAAsB,EAAE,eAA4B,EACpD,WAAwB,EAAE,aAA4B,EACtD,kBAAiC,EAAE,QAAuB;IAE1D,OAAO,uCAAkB,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EACtE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,QAAQ,CAAC,CAAA;AAC9E,CAAC;AARD,sDAQC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,OAAgB,EAClD,SAAe;IACf,OAAO,mCAAgB,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;AACrD,CAAC;AAHD,kDAGC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/CustomElementAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/CustomElementAlgorithm.d.ts new file mode 100644 index 0000000..b1da77e --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/CustomElementAlgorithm.d.ts @@ -0,0 +1,61 @@ +import { Element, Document, CustomElementDefinition } from "../dom/interfaces"; +/** + * Determines if the given string is a valid custom element name. + * + * @param name - a name string + */ +export declare function customElement_isValidCustomElementName(name: string): boolean; +/** + * Determines if the given string is a valid element name. + * + * @param name - a name string + */ +export declare function customElement_isValidElementName(name: string): boolean; +/** + * Determines if the given string is a void element name. + * + * @param name - a name string + */ +export declare function customElement_isVoidElementName(name: string): boolean; +/** + * Determines if the given string is a valid shadow host element name. + * + * @param name - a name string + */ +export declare function customElement_isValidShadowHostName(name: string): boolean; +/** + * Enqueues an upgrade reaction for a custom element. + * + * @param element - a custom element + * @param definition - a custom element definition + */ +export declare function customElement_enqueueACustomElementUpgradeReaction(element: Element, definition: CustomElementDefinition): void; +/** + * Enqueues a callback reaction for a custom element. + * + * @param element - a custom element + * @param callbackName - name of the callback + * @param args - callback arguments + */ +export declare function customElement_enqueueACustomElementCallbackReaction(element: Element, callbackName: string, args: any[]): void; +/** + * Upgrade a custom element. + * + * @param element - a custom element + */ +export declare function customElement_upgrade(definition: CustomElementDefinition, element: Element): void; +/** + * Tries to upgrade a custom element. + * + * @param element - a custom element + */ +export declare function customElement_tryToUpgrade(element: Element): void; +/** + * Looks up a custom element definition. + * + * @param document - a document + * @param namespace - element namespace + * @param localName - element local name + * @param is - an `is` value + */ +export declare function customElement_lookUpACustomElementDefinition(document: Document, namespace: string | null, localName: string | null, is: string | null): CustomElementDefinition | null; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/CustomElementAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/CustomElementAlgorithm.js new file mode 100644 index 0000000..b9dd3e3 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/CustomElementAlgorithm.js @@ -0,0 +1,108 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var PotentialCustomElementName = /[a-z]([\0-\t\x2D\._a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*-([\0-\t\x2D\._a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*/; +var NamesWithHyphen = new Set(['annotation-xml', 'color-profile', + 'font-face', 'font-face-src', 'font-face-uri', 'font-face-format', + 'font-face-name', 'missing-glyph']); +var ElementNames = new Set(['article', 'aside', 'blockquote', + 'body', 'div', 'footer', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', + 'header', 'main', 'nav', 'p', 'section', 'span']); +var VoidElementNames = new Set(['area', 'base', 'basefont', + 'bgsound', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'keygen', + 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']); +var ShadowHostNames = new Set(['article', 'aside', 'blockquote', 'body', + 'div', 'footer', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'main', + 'nav', 'p', 'section', 'span']); +/** + * Determines if the given string is a valid custom element name. + * + * @param name - a name string + */ +function customElement_isValidCustomElementName(name) { + if (!PotentialCustomElementName.test(name)) + return false; + if (NamesWithHyphen.has(name)) + return false; + return true; +} +exports.customElement_isValidCustomElementName = customElement_isValidCustomElementName; +/** + * Determines if the given string is a valid element name. + * + * @param name - a name string + */ +function customElement_isValidElementName(name) { + return (ElementNames.has(name)); +} +exports.customElement_isValidElementName = customElement_isValidElementName; +/** + * Determines if the given string is a void element name. + * + * @param name - a name string + */ +function customElement_isVoidElementName(name) { + return (VoidElementNames.has(name)); +} +exports.customElement_isVoidElementName = customElement_isVoidElementName; +/** + * Determines if the given string is a valid shadow host element name. + * + * @param name - a name string + */ +function customElement_isValidShadowHostName(name) { + return (ShadowHostNames.has(name)); +} +exports.customElement_isValidShadowHostName = customElement_isValidShadowHostName; +/** + * Enqueues an upgrade reaction for a custom element. + * + * @param element - a custom element + * @param definition - a custom element definition + */ +function customElement_enqueueACustomElementUpgradeReaction(element, definition) { + // TODO: Implement in HTML DOM +} +exports.customElement_enqueueACustomElementUpgradeReaction = customElement_enqueueACustomElementUpgradeReaction; +/** + * Enqueues a callback reaction for a custom element. + * + * @param element - a custom element + * @param callbackName - name of the callback + * @param args - callback arguments + */ +function customElement_enqueueACustomElementCallbackReaction(element, callbackName, args) { + // TODO: Implement in HTML DOM +} +exports.customElement_enqueueACustomElementCallbackReaction = customElement_enqueueACustomElementCallbackReaction; +/** + * Upgrade a custom element. + * + * @param element - a custom element + */ +function customElement_upgrade(definition, element) { + // TODO: Implement in HTML DOM +} +exports.customElement_upgrade = customElement_upgrade; +/** + * Tries to upgrade a custom element. + * + * @param element - a custom element + */ +function customElement_tryToUpgrade(element) { + // TODO: Implement in HTML DOM +} +exports.customElement_tryToUpgrade = customElement_tryToUpgrade; +/** + * Looks up a custom element definition. + * + * @param document - a document + * @param namespace - element namespace + * @param localName - element local name + * @param is - an `is` value + */ +function customElement_lookUpACustomElementDefinition(document, namespace, localName, is) { + // TODO: Implement in HTML DOM + return null; +} +exports.customElement_lookUpACustomElementDefinition = customElement_lookUpACustomElementDefinition; +//# sourceMappingURL=CustomElementAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/CustomElementAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/CustomElementAlgorithm.js.map new file mode 100644 index 0000000..a436078 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/CustomElementAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CustomElementAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/CustomElementAlgorithm.ts"],"names":[],"mappings":";;AAEA,IAAM,0BAA0B,GAAG,4XAA4X,CAAA;AAE/Z,IAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,gBAAgB,EAAE,eAAe;IAChE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,kBAAkB;IACjE,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAA;AAErC,IAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,SA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CAAC,IAAY;IAC1D,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;AACrC,CAAC;AAFD,0EAEC;AAED;;;;GAIG;AACH,SAAgB,mCAAmC,CAAC,IAAY;IAC9D,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;AACpC,CAAC;AAFD,kFAEC;AAED;;;;;GAKG;AACH,SAAgB,kDAAkD,CAAC,OAAgB,EACjF,UAAmC;IACnC,8BAA8B;AAChC,CAAC;AAHD,gHAGC;AAED;;;;;;GAMG;AACH,SAAgB,mDAAmD,CAAC,OAAgB,EAClF,YAAoB,EAAE,IAAW;IACjC,8BAA8B;AAChC,CAAC;AAHD,kHAGC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,UAAmC,EAAE,OAAgB;IACzF,8BAA8B;AAChC,CAAC;AAFD,sDAEC;AAED;;;;GAIG;AACH,SAAgB,0BAA0B,CAAC,OAAgB;IACzD,8BAA8B;AAChC,CAAC;AAFD,gEAEC;AAED;;;;;;;GAOG;AACH,SAAgB,4CAA4C,CAAC,QAAkB,EAC7E,SAAwB,EAAE,SAAwB,EAAE,EAAiB;IAErE,8BAA8B;IAC9B,OAAO,IAAI,CAAA;AACb,CAAC;AALD,oGAKC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/DOMAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/DOMAlgorithm.d.ts new file mode 100644 index 0000000..4e25797 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/DOMAlgorithm.d.ts @@ -0,0 +1,72 @@ +import { Node, Element, NodeIterator, Document, Event } from "../dom/interfaces"; +/** + * Runs removing steps for node. + * + * @param removedNode - removed node + * @param oldParent - old parent node + */ +export declare function dom_runRemovingSteps(removedNode: Node, oldParent: Node): void; +/** + * Runs cloning steps for node. + * + * @param copy - node clone + * @param node - node + * @param document - document to own the cloned node + * @param cloneChildrenFlag - whether child nodes are cloned + */ +export declare function dom_runCloningSteps(copy: Node, node: Node, document: Document, cloneChildrenFlag: boolean): void; +/** + * Runs adopting steps for node. + * + * @param node - node + * @param oldDocument - old document + */ +export declare function dom_runAdoptingSteps(node: Node, oldDocument: Document): void; +/** + * Runs attribute change steps for an element node. + * + * @param element - element node owning the attribute + * @param localName - attribute's local name + * @param oldValue - attribute's old value + * @param value - attribute's new value + * @param namespace - attribute's namespace + */ +export declare function dom_runAttributeChangeSteps(element: Element, localName: string, oldValue: string | null, value: string | null, namespace: string | null): void; +/** + * Runs insertion steps for a node. + * + * @param insertedNode - inserted node + */ +export declare function dom_runInsertionSteps(insertedNode: Node): void; +/** + * Runs pre-removing steps for a node iterator and node. + * + * @param nodeIterator - a node iterator + * @param toBeRemoved - node to be removed + */ +export declare function dom_runNodeIteratorPreRemovingSteps(nodeIterator: NodeIterator, toBeRemoved: Node): void; +/** + * Determines if there are any supported tokens defined for the given + * attribute name. + * + * @param attributeName - an attribute name + */ +export declare function dom_hasSupportedTokens(attributeName: string): boolean; +/** + * Returns the set of supported tokens defined for the given attribute name. + * + * @param attributeName - an attribute name + */ +export declare function dom_getSupportedTokens(attributeName: string): Set; +/** + * Runs event construction steps. + * + * @param event - an event + */ +export declare function dom_runEventConstructingSteps(event: Event): void; +/** + * Runs child text content change steps for a parent node. + * + * @param parent - parent node with text node child nodes + */ +export declare function dom_runChildTextContentChangeSteps(parent: Node): void; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/DOMAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/DOMAlgorithm.js new file mode 100644 index 0000000..26e4cc7 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/DOMAlgorithm.js @@ -0,0 +1,288 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("../dom/DOMImpl"); +var TreeAlgorithm_1 = require("./TreeAlgorithm"); +var util_1 = require("../util"); +var ShadowTreeAlgorithm_1 = require("./ShadowTreeAlgorithm"); +var supportedTokens = new Map(); +/** + * Runs removing steps for node. + * + * @param removedNode - removed node + * @param oldParent - old parent node + */ +function dom_runRemovingSteps(removedNode, oldParent) { + // No steps defined +} +exports.dom_runRemovingSteps = dom_runRemovingSteps; +/** + * Runs cloning steps for node. + * + * @param copy - node clone + * @param node - node + * @param document - document to own the cloned node + * @param cloneChildrenFlag - whether child nodes are cloned + */ +function dom_runCloningSteps(copy, node, document, cloneChildrenFlag) { + // No steps defined +} +exports.dom_runCloningSteps = dom_runCloningSteps; +/** + * Runs adopting steps for node. + * + * @param node - node + * @param oldDocument - old document + */ +function dom_runAdoptingSteps(node, oldDocument) { + // No steps defined +} +exports.dom_runAdoptingSteps = dom_runAdoptingSteps; +/** + * Runs attribute change steps for an element node. + * + * @param element - element node owning the attribute + * @param localName - attribute's local name + * @param oldValue - attribute's old value + * @param value - attribute's new value + * @param namespace - attribute's namespace + */ +function dom_runAttributeChangeSteps(element, localName, oldValue, value, namespace) { + var e_1, _a; + // run default steps + if (DOMImpl_1.dom.features.slots) { + updateASlotablesName.call(element, element, localName, oldValue, value, namespace); + updateASlotsName.call(element, element, localName, oldValue, value, namespace); + } + updateAnElementID.call(element, element, localName, value, namespace); + try { + // run custom steps + for (var _b = __values(element._attributeChangeSteps), _c = _b.next(); !_c.done; _c = _b.next()) { + var step = _c.value; + step.call(element, element, localName, oldValue, value, namespace); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } +} +exports.dom_runAttributeChangeSteps = dom_runAttributeChangeSteps; +/** + * Runs insertion steps for a node. + * + * @param insertedNode - inserted node + */ +function dom_runInsertionSteps(insertedNode) { + // No steps defined +} +exports.dom_runInsertionSteps = dom_runInsertionSteps; +/** + * Runs pre-removing steps for a node iterator and node. + * + * @param nodeIterator - a node iterator + * @param toBeRemoved - node to be removed + */ +function dom_runNodeIteratorPreRemovingSteps(nodeIterator, toBeRemoved) { + removeNodeIterator.call(nodeIterator, nodeIterator, toBeRemoved); +} +exports.dom_runNodeIteratorPreRemovingSteps = dom_runNodeIteratorPreRemovingSteps; +/** + * Determines if there are any supported tokens defined for the given + * attribute name. + * + * @param attributeName - an attribute name + */ +function dom_hasSupportedTokens(attributeName) { + return supportedTokens.has(attributeName); +} +exports.dom_hasSupportedTokens = dom_hasSupportedTokens; +/** + * Returns the set of supported tokens defined for the given attribute name. + * + * @param attributeName - an attribute name + */ +function dom_getSupportedTokens(attributeName) { + return supportedTokens.get(attributeName) || new Set(); +} +exports.dom_getSupportedTokens = dom_getSupportedTokens; +/** + * Runs event construction steps. + * + * @param event - an event + */ +function dom_runEventConstructingSteps(event) { + // No steps defined +} +exports.dom_runEventConstructingSteps = dom_runEventConstructingSteps; +/** + * Runs child text content change steps for a parent node. + * + * @param parent - parent node with text node child nodes + */ +function dom_runChildTextContentChangeSteps(parent) { + // No steps defined +} +exports.dom_runChildTextContentChangeSteps = dom_runChildTextContentChangeSteps; +/** + * Defines pre-removing steps for a node iterator. + */ +function removeNodeIterator(nodeIterator, toBeRemovedNode) { + /** + * 1. If toBeRemovedNode is not an inclusive ancestor of nodeIterator’s + * reference, or toBeRemovedNode is nodeIterator’s root, then return. + */ + if (toBeRemovedNode === nodeIterator._root || + !TreeAlgorithm_1.tree_isAncestorOf(nodeIterator._reference, toBeRemovedNode, true)) { + return; + } + /** + * 2. If nodeIterator’s pointer before reference is true, then: + */ + if (nodeIterator._pointerBeforeReference) { + /** + * 2.1. Let next be toBeRemovedNode’s first following node that is an + * inclusive descendant of nodeIterator’s root and is not an inclusive + * descendant of toBeRemovedNode, and null if there is no such node. + */ + while (true) { + var nextNode = TreeAlgorithm_1.tree_getFollowingNode(nodeIterator._root, toBeRemovedNode); + if (nextNode !== null && + TreeAlgorithm_1.tree_isDescendantOf(nodeIterator._root, nextNode, true) && + !TreeAlgorithm_1.tree_isDescendantOf(toBeRemovedNode, nextNode, true)) { + /** + * 2.2. If next is non-null, then set nodeIterator’s reference to next + * and return. + */ + nodeIterator._reference = nextNode; + return; + } + else if (nextNode === null) { + /** + * 2.3. Otherwise, set nodeIterator’s pointer before reference to false. + */ + nodeIterator._pointerBeforeReference = false; + return; + } + } + } + /** + * 3. Set nodeIterator’s reference to toBeRemovedNode’s parent, if + * toBeRemovedNode’s previous sibling is null, and to the inclusive + * descendant of toBeRemovedNode’s previous sibling that appears last in + * tree order otherwise. + */ + if (toBeRemovedNode._previousSibling === null) { + if (toBeRemovedNode._parent !== null) { + nodeIterator._reference = toBeRemovedNode._parent; + } + } + else { + var referenceNode = toBeRemovedNode._previousSibling; + var childNode = TreeAlgorithm_1.tree_getFirstDescendantNode(toBeRemovedNode._previousSibling, true, false); + while (childNode !== null) { + if (childNode !== null) { + referenceNode = childNode; + } + // loop through to get the last descendant node + childNode = TreeAlgorithm_1.tree_getNextDescendantNode(toBeRemovedNode._previousSibling, childNode, true, false); + } + nodeIterator._reference = referenceNode; + } +} +/** + * Defines attribute change steps to update a slot’s name. + */ +function updateASlotsName(element, localName, oldValue, value, namespace) { + /** + * 1. If element is a slot, localName is name, and namespace is null, then: + * 1.1. If value is oldValue, then return. + * 1.2. If value is null and oldValue is the empty string, then return. + * 1.3. If value is the empty string and oldValue is null, then return. + * 1.4. If value is null or the empty string, then set element’s name to the + * empty string. + * 1.5. Otherwise, set element’s name to value. + * 1.6. Run assign slotables for a tree with element’s root. + */ + if (util_1.Guard.isSlot(element) && localName === "name" && namespace === null) { + if (value === oldValue) + return; + if (value === null && oldValue === '') + return; + if (value === '' && oldValue === null) + return; + if ((value === null || value === '')) { + element._name = ''; + } + else { + element._name = value; + } + ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(TreeAlgorithm_1.tree_rootNode(element)); + } +} +/** + * Defines attribute change steps to update a slotable’s name. + */ +function updateASlotablesName(element, localName, oldValue, value, namespace) { + /** + * 1. If localName is slot and namespace is null, then: + * 1.1. If value is oldValue, then return. + * 1.2. If value is null and oldValue is the empty string, then return. + * 1.3. If value is the empty string and oldValue is null, then return. + * 1.4. If value is null or the empty string, then set element’s name to + * the empty string. + * 1.5. Otherwise, set element’s name to value. + * 1.6. If element is assigned, then run assign slotables for element’s + * assigned slot. + * 1.7. Run assign a slot for element. + */ + if (util_1.Guard.isSlotable(element) && localName === "slot" && namespace === null) { + if (value === oldValue) + return; + if (value === null && oldValue === '') + return; + if (value === '' && oldValue === null) + return; + if ((value === null || value === '')) { + element._name = ''; + } + else { + element._name = value; + } + if (ShadowTreeAlgorithm_1.shadowTree_isAssigned(element)) { + ShadowTreeAlgorithm_1.shadowTree_assignSlotables(element._assignedSlot); + } + ShadowTreeAlgorithm_1.shadowTree_assignASlot(element); + } +} +/** + * Defines attribute change steps to update an element's ID. + */ +function updateAnElementID(element, localName, value, namespace) { + /** + * 1. If localName is id, namespace is null, and value is null or the empty + * string, then unset element’s ID. + * 2. Otherwise, if localName is id, namespace is null, then set element’s + * ID to value. + */ + if (localName === "id" && namespace === null) { + if (!value) + element._uniqueIdentifier = undefined; + else + element._uniqueIdentifier = value; + } +} +//# sourceMappingURL=DOMAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/DOMAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/DOMAlgorithm.js.map new file mode 100644 index 0000000..e211931 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/DOMAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DOMAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/DOMAlgorithm.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,0CAAoC;A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,GAAG,KAAK,CAAA;KACpC;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/DOMTokenListAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/DOMTokenListAlgorithm.d.ts new file mode 100644 index 0000000..b5084e9 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/DOMTokenListAlgorithm.d.ts @@ -0,0 +1,21 @@ +import { DOMTokenList } from "../dom/interfaces"; +/** + * Validates a given token against the supported tokens defined for the given + * token lists' associated attribute. + * + * @param tokenList - a token list + * @param token - a token + */ +export declare function tokenList_validationSteps(tokenList: DOMTokenList, token: string): boolean; +/** + * Updates the value of the token lists' associated attribute. + * + * @param tokenList - a token list + */ +export declare function tokenList_updateSteps(tokenList: DOMTokenList): void; +/** + * Gets the value of the token lists' associated attribute. + * + * @param tokenList - a token list + */ +export declare function tokenList_serializeSteps(tokenList: DOMTokenList): string; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/DOMTokenListAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/DOMTokenListAlgorithm.js new file mode 100644 index 0000000..a85c786 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/DOMTokenListAlgorithm.js @@ -0,0 +1,61 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var OrderedSetAlgorithm_1 = require("./OrderedSetAlgorithm"); +var DOMAlgorithm_1 = require("./DOMAlgorithm"); +var ElementAlgorithm_1 = require("./ElementAlgorithm"); +/** + * Validates a given token against the supported tokens defined for the given + * token lists' associated attribute. + * + * @param tokenList - a token list + * @param token - a token + */ +function tokenList_validationSteps(tokenList, token) { + /** + * 1. If the associated attribute’s local name does not define supported + * tokens, throw a TypeError. + * 2. Let lowercase token be a copy of token, in ASCII lowercase. + * 3. If lowercase token is present in supported tokens, return true. + * 4. Return false. + */ + if (!DOMAlgorithm_1.dom_hasSupportedTokens(tokenList._attribute._localName)) { + throw new TypeError("There are no supported tokens defined for attribute name: '" + tokenList._attribute._localName + "'."); + } + return DOMAlgorithm_1.dom_getSupportedTokens(tokenList._attribute._localName).has(token.toLowerCase()); +} +exports.tokenList_validationSteps = tokenList_validationSteps; +/** + * Updates the value of the token lists' associated attribute. + * + * @param tokenList - a token list + */ +function tokenList_updateSteps(tokenList) { + /** + * 1. If the associated element does not have an associated attribute and + * token set is empty, then return. + * 2. Set an attribute value for the associated element using associated + * attribute’s local name and the result of running the ordered set + * serializer for token set. + */ + if (!tokenList._element.hasAttribute(tokenList._attribute._localName) && + tokenList._tokenSet.size === 0) { + return; + } + ElementAlgorithm_1.element_setAnAttributeValue(tokenList._element, tokenList._attribute._localName, OrderedSetAlgorithm_1.orderedSet_serialize(tokenList._tokenSet)); +} +exports.tokenList_updateSteps = tokenList_updateSteps; +/** + * Gets the value of the token lists' associated attribute. + * + * @param tokenList - a token list + */ +function tokenList_serializeSteps(tokenList) { + /** + * A DOMTokenList object’s serialize steps are to return the result of + * running get an attribute value given the associated element and the + * associated attribute’s local name. + */ + return ElementAlgorithm_1.element_getAnAttributeValue(tokenList._element, tokenList._attribute._localName); +} +exports.tokenList_serializeSteps = tokenList_serializeSteps; +//# sourceMappingURL=DOMTokenListAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/DOMTokenListAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/DOMTokenListAlgorithm.js.map new file mode 100644 index 0000000..0826183 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/DOMTokenListAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DOMTokenListAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/DOMTokenListAlgorithm.ts"],"names":[],"mappings":";;AACA,6DAA4D;AAC5D,+CAA+E;AAC/E,uDAE2B;AAE3B;;;;;;GAMG;AACH,SAAgB,yBAAyB,CAAC,SAAuB,EAC/D,KAAa;IACb;;;;;;OAMG;IACH,IAAI,CAAC,qCAAsB,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;QAC5D,MAAM,IAAI,SAAS,CAAC,gEAA8D,SAAS,CAAC,UAAU,CAAC,UAAU,OAAI,CAAC,CAAA;KACvH;IACD,OAAO,qCAAsB,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;AACzF,CAAC;AAbD,8DAaC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,SAAuB;IAC3D;;;;;;OAMG;IACH,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC;QACnE,SAAS,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,EAAE;QAChC,OAAM;KACP;IACD,8CAA2B,CAAC,SAAS,CAAC,QAAQ,EAC5C,SAAS,CAAC,UAAU,CAAC,UAAU,EAAE,0CAAoB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAA;AAC/E,CAAC;AAdD,sDAcC;AAED;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,SAAuB;IAC9D;;;;OAIG;IACH,OAAO,8CAA2B,CAChC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;AACxD,CAAC;AARD,4DAQC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/DocumentAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/DocumentAlgorithm.d.ts new file mode 100644 index 0000000..d459966 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/DocumentAlgorithm.d.ts @@ -0,0 +1,29 @@ +import { Element, Document, Node } from "../dom/interfaces"; +/** + * Returns an element interface for the given name and namespace. + * + * @param name - element name + * @param namespace - namespace + */ +export declare function document_elementInterface(name: string, namespace: string | null): (new (...args: any[]) => Element); +/** + * Creates a new element node. + * See: https://dom.spec.whatwg.org/#internal-createelementns-steps + * + * @param document - owner document + * @param namespace - element namespace + * @param qualifiedName - qualified name + * @param options - element options + */ +export declare function document_internalCreateElementNS(document: Document, namespace: string | null, qualifiedName: string, options?: string | { + is: string; +}): Element; +/** + * Removes `node` and its subtree from its document and changes + * its owner document to `document` so that it can be inserted + * into `document`. + * + * @param node - the node to move + * @param document - document to receive the node and its subtree + */ +export declare function document_adopt(node: Node, document: Document): void; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/DocumentAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/DocumentAlgorithm.js new file mode 100644 index 0000000..a3be8cb --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/DocumentAlgorithm.js @@ -0,0 +1,161 @@ +"use strict"; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("../dom/DOMImpl"); +var util_1 = require("../util"); +var util_2 = require("@oozcitak/util"); +var ElementImpl_1 = require("../dom/ElementImpl"); +var CustomElementAlgorithm_1 = require("./CustomElementAlgorithm"); +var TreeAlgorithm_1 = require("./TreeAlgorithm"); +var NamespaceAlgorithm_1 = require("./NamespaceAlgorithm"); +var DOMAlgorithm_1 = require("./DOMAlgorithm"); +var ElementAlgorithm_1 = require("./ElementAlgorithm"); +var MutationAlgorithm_1 = require("./MutationAlgorithm"); +/** + * Returns an element interface for the given name and namespace. + * + * @param name - element name + * @param namespace - namespace + */ +function document_elementInterface(name, namespace) { + return ElementImpl_1.ElementImpl; +} +exports.document_elementInterface = document_elementInterface; +/** + * Creates a new element node. + * See: https://dom.spec.whatwg.org/#internal-createelementns-steps + * + * @param document - owner document + * @param namespace - element namespace + * @param qualifiedName - qualified name + * @param options - element options + */ +function document_internalCreateElementNS(document, namespace, qualifiedName, options) { + /** + * 1. Let namespace, prefix, and localName be the result of passing + * namespace and qualifiedName to validate and extract. + * 2. Let is be null. + * 3. If options is a dictionary and options’s is is present, then set + * is to it. + * 4. Return the result of creating an element given document, localName, + * namespace, prefix, is, and with the synchronous custom elements flag set. + */ + var _a = __read(NamespaceAlgorithm_1.namespace_validateAndExtract(namespace, qualifiedName), 3), ns = _a[0], prefix = _a[1], localName = _a[2]; + var is = null; + if (options !== undefined) { + if (util_2.isString(options)) { + is = options; + } + else { + is = options.is; + } + } + return ElementAlgorithm_1.element_createAnElement(document, localName, ns, prefix, is, true); +} +exports.document_internalCreateElementNS = document_internalCreateElementNS; +/** + * Removes `node` and its subtree from its document and changes + * its owner document to `document` so that it can be inserted + * into `document`. + * + * @param node - the node to move + * @param document - document to receive the node and its subtree + */ +function document_adopt(node, document) { + var e_1, _a; + // Optimize for common case of inserting a fresh node + if (node._nodeDocument === document && node._parent === null) { + return; + } + /** + * 1. Let oldDocument be node’s node document. + * 2. If node’s parent is not null, remove node from its parent. + */ + var oldDocument = node._nodeDocument; + if (node._parent) + MutationAlgorithm_1.mutation_remove(node, node._parent); + /** + * 3. If document is not oldDocument, then: + */ + if (document !== oldDocument) { + /** + * 3.1. For each inclusiveDescendant in node’s shadow-including inclusive + * descendants: + */ + var inclusiveDescendant = TreeAlgorithm_1.tree_getFirstDescendantNode(node, true, true); + while (inclusiveDescendant !== null) { + /** + * 3.1.1. Set inclusiveDescendant’s node document to document. + * 3.1.2. If inclusiveDescendant is an element, then set the node + * document of each attribute in inclusiveDescendant’s attribute list + * to document. + */ + inclusiveDescendant._nodeDocument = document; + if (util_1.Guard.isElementNode(inclusiveDescendant)) { + try { + for (var _b = (e_1 = void 0, __values(inclusiveDescendant._attributeList._asArray())), _c = _b.next(); !_c.done; _c = _b.next()) { + var attr = _c.value; + attr._nodeDocument = document; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + } + /** + * 3.2. For each inclusiveDescendant in node's shadow-including + * inclusive descendants that is custom, enqueue a custom + * element callback reaction with inclusiveDescendant, + * callback name "adoptedCallback", and an argument list + * containing oldDocument and document. + */ + if (DOMImpl_1.dom.features.customElements) { + if (util_1.Guard.isElementNode(inclusiveDescendant) && + inclusiveDescendant._customElementState === "custom") { + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(inclusiveDescendant, "adoptedCallback", [oldDocument, document]); + } + } + /** + * 3.3. For each inclusiveDescendant in node’s shadow-including + * inclusive descendants, in shadow-including tree order, run the + * adopting steps with inclusiveDescendant and oldDocument. + */ + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runAdoptingSteps(inclusiveDescendant, oldDocument); + } + inclusiveDescendant = TreeAlgorithm_1.tree_getNextDescendantNode(node, inclusiveDescendant, true, true); + } + } +} +exports.document_adopt = document_adopt; +//# sourceMappingURL=DocumentAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/DocumentAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/DocumentAlgorithm.js.map new file mode 100644 index 0000000..04c91c3 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/DocumentAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DocumentAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/DocumentAlgorithm.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAo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,IAAI,CAAC,CAAA;QACvE,OAAO,mBAAmB,KAAK,IAAI,EAAE;YACnC;;;;;eAKG;YACH,mBAAmB,CAAC,aAAa,GAAG,QAAoB,CAAA;YAExD,IAAI,YAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,EAAE;;oBAC5C,KAAmB,IAAA,oBAAA,SAAA,mBAAmB,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAA,CAAA,gBAAA,4BAAE;wBAA7D,IAAM,IAAI,WAAA;wBACb,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAA;qBAC9B;;;;;;;;;aACF;YAED;;;;;;eAMG;YACH,IAAI,aAAG,CAAC,QAAQ,CAAC,cAAc,EAAE;gBAC/B,IAAI,YAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC;oBAC1C,mBAAmB,CAAC,mBAAmB,KAAK,QAAQ,EAAE;oBACtD,4EAAmD,CACjD,mBAAmB,EAAE,iBAAiB,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAA;iBACnE;aACF;YAED;;;;eAIG;YACH,IAAI,aAAG,CAAC,QAAQ,CAAC,KAAK,EAAE;gBACtB,mCAAoB,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAA;aACvD;YAED,mBAAmB,GAAG,0CAA0B,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;SACxF;KACF;AACH,CAAC;AAlED,wCAkEC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/ElementAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/ElementAlgorithm.d.ts new file mode 100644 index 0000000..ed5d0da --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/ElementAlgorithm.d.ts @@ -0,0 +1,121 @@ +import { Attr, Element, Document, Node } from "../dom/interfaces"; +/** + * Determines whether the element's attribute list contains the given + * attribute. + * + * @param attribute - an attribute node + * @param element - an element node + */ +export declare function element_has(attribute: Attr, element: Element): boolean; +/** + * Changes the value of an attribute node. + * + * @param attribute - an attribute node + * @param element - an element node + * @param value - attribute value + */ +export declare function element_change(attribute: Attr, element: Element, value: string): void; +/** + * Appends an attribute to an element node. + * + * @param attribute - an attribute + * @param element - an element to receive the attribute + */ +export declare function element_append(attribute: Attr, element: Element): void; +/** + * Removes an attribute from an element node. + * + * @param attribute - an attribute + * @param element - an element to receive the attribute + */ +export declare function element_remove(attribute: Attr, element: Element): void; +/** + * Replaces an attribute with another of an element node. + * + * @param oldAttr - old attribute + * @param newAttr - new attribute + * @param element - an element to receive the attribute + */ +export declare function element_replace(oldAttr: Attr, newAttr: Attr, element: Element): void; +/** + * Retrieves an attribute with the given name from an element node. + * + * @param qualifiedName - an attribute name + * @param element - an element to receive the attribute + */ +export declare function element_getAnAttributeByName(qualifiedName: string, element: Element): Attr | null; +/** + * Retrieves an attribute with the given namespace and local name from an + * element node. + * + * @param namespace - an attribute namespace + * @param localName - an attribute local name + * @param element - an element to receive the attribute + */ +export declare function element_getAnAttributeByNamespaceAndLocalName(namespace: string, localName: string, element: Element): Attr | null; +/** + * Retrieves an attribute's value with the given name namespace and local + * name from an element node. + * + * @param element - an element to receive the attribute + * @param localName - an attribute local name + * @param namespace - an attribute namespace + */ +export declare function element_getAnAttributeValue(element: Element, localName: string, namespace?: string): string; +/** + * Sets an attribute of an element node. + * + * @param attr - an attribute + * @param element - an element to receive the attribute + */ +export declare function element_setAnAttribute(attr: Attr, element: Element): Attr | null; +/** + * Sets an attribute's value of an element node. + * + * @param element - an element to receive the attribute + * @param localName - an attribute local name + * @param value - an attribute value + * @param prefix - an attribute prefix + * @param namespace - an attribute namespace + */ +export declare function element_setAnAttributeValue(element: Element, localName: string, value: string, prefix?: string | null, namespace?: string | null): void; +/** + * Removes an attribute with the given name from an element node. + * + * @param qualifiedName - an attribute name + * @param element - an element to receive the attribute + */ +export declare function element_removeAnAttributeByName(qualifiedName: string, element: Element): Attr | null; +/** + * Removes an attribute with the given namespace and local name from an + * element node. + * + * @param namespace - an attribute namespace + * @param localName - an attribute local name + * @param element - an element to receive the attribute + */ +export declare function element_removeAnAttributeByNamespaceAndLocalName(namespace: string, localName: string, element: Element): Attr | null; +/** + * Creates an element node. + * See: https://dom.spec.whatwg.org/#concept-create-element. + * + * @param document - the document owning the element + * @param localName - local name + * @param namespace - element namespace + * @param prefix - namespace prefix + * @param is - the "is" value + * @param synchronousCustomElementsFlag - synchronous custom elements flag + */ +export declare function element_createAnElement(document: Document, localName: string, namespace: string | null, prefix?: string | null, is?: string | null, synchronousCustomElementsFlag?: boolean): Element; +/** + * Inserts a new node adjacent to this element. + * + * @param element - a reference element + * @param where - a string defining where to insert the element node. + * - `beforebegin` before this element itself. + * - `afterbegin` before the first child. + * - `beforeend` after the last child. + * - `afterend` after this element itself. + * @param node - node to insert + */ +export declare function element_insertAdjacent(element: Element, where: "beforebegin" | "afterbegin" | "beforeend" | "afterend", node: Node): Node | null; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/ElementAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/ElementAlgorithm.js new file mode 100644 index 0000000..97385b4 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/ElementAlgorithm.js @@ -0,0 +1,608 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("../dom/DOMImpl"); +var infra_1 = require("@oozcitak/infra"); +var util_1 = require("../util"); +var DOMException_1 = require("../dom/DOMException"); +var CreateAlgorithm_1 = require("./CreateAlgorithm"); +var CustomElementAlgorithm_1 = require("./CustomElementAlgorithm"); +var MutationObserverAlgorithm_1 = require("./MutationObserverAlgorithm"); +var DOMAlgorithm_1 = require("./DOMAlgorithm"); +var MutationAlgorithm_1 = require("./MutationAlgorithm"); +var DocumentAlgorithm_1 = require("./DocumentAlgorithm"); +/** + * Determines whether the element's attribute list contains the given + * attribute. + * + * @param attribute - an attribute node + * @param element - an element node + */ +function element_has(attribute, element) { + /** + * An element has an attribute A if its attribute list contains A. + */ + return element._attributeList._asArray().indexOf(attribute) !== -1; +} +exports.element_has = element_has; +/** + * Changes the value of an attribute node. + * + * @param attribute - an attribute node + * @param element - an element node + * @param value - attribute value + */ +function element_change(attribute, element, value) { + /** + * 1. Queue an attribute mutation record for element with attribute’s + * local name, attribute’s namespace, and attribute’s value. + */ + if (DOMImpl_1.dom.features.mutationObservers) { + MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord(element, attribute._localName, attribute._namespace, attribute._value); + } + /** + * 2. If element is custom, then enqueue a custom element callback reaction + * with element, callback name "attributeChangedCallback", and an argument + * list containing attribute’s local name, attribute’s value, value, and + * attribute’s namespace. + */ + if (DOMImpl_1.dom.features.customElements) { + if (util_1.Guard.isCustomElementNode(element)) { + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(element, "attributeChangedCallback", [attribute._localName, attribute._value, value, attribute._namespace]); + } + } + /** + * 3. Run the attribute change steps with element, attribute’s local name, + * attribute’s value, value, and attribute’s namespace. + * 4. Set attribute’s value to value. + */ + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runAttributeChangeSteps(element, attribute._localName, attribute._value, value, attribute._namespace); + } + attribute._value = value; +} +exports.element_change = element_change; +/** + * Appends an attribute to an element node. + * + * @param attribute - an attribute + * @param element - an element to receive the attribute + */ +function element_append(attribute, element) { + /** + * 1. Queue an attribute mutation record for element with attribute’s + * local name, attribute’s namespace, and null. + */ + if (DOMImpl_1.dom.features.mutationObservers) { + MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord(element, attribute._localName, attribute._namespace, null); + } + /** + * 2. If element is custom, then enqueue a custom element callback reaction + * with element, callback name "attributeChangedCallback", and an argument + * list containing attribute’s local name, null, attribute’s value, and + * attribute’s namespace. + */ + if (DOMImpl_1.dom.features.customElements) { + if (util_1.Guard.isCustomElementNode(element)) { + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(element, "attributeChangedCallback", [attribute._localName, null, attribute._value, attribute._namespace]); + } + } + /** + * 3. Run the attribute change steps with element, attribute’s local name, + * null, attribute’s value, and attribute’s namespace. + */ + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runAttributeChangeSteps(element, attribute._localName, null, attribute._value, attribute._namespace); + } + /** + * 4. Append attribute to element’s attribute list. + * 5. Set attribute’s element to element. + */ + element._attributeList._asArray().push(attribute); + attribute._element = element; + // mark that the document has namespaces + if (!element._nodeDocument._hasNamespaces && (attribute._namespace !== null || + attribute._namespacePrefix !== null || attribute._localName === "xmlns")) { + element._nodeDocument._hasNamespaces = true; + } +} +exports.element_append = element_append; +/** + * Removes an attribute from an element node. + * + * @param attribute - an attribute + * @param element - an element to receive the attribute + */ +function element_remove(attribute, element) { + /** + * 1. Queue an attribute mutation record for element with attribute’s + * local name, attribute’s namespace, and attribute’s value. + */ + if (DOMImpl_1.dom.features.mutationObservers) { + MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord(element, attribute._localName, attribute._namespace, attribute._value); + } + /** + * 2. If element is custom, then enqueue a custom element callback reaction + * with element, callback name "attributeChangedCallback", and an argument + * list containing attribute’s local name, attribute’s value, null, + * and attribute’s namespace. + */ + if (DOMImpl_1.dom.features.customElements) { + if (util_1.Guard.isCustomElementNode(element)) { + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(element, "attributeChangedCallback", [attribute._localName, attribute._value, null, attribute._namespace]); + } + } + /** + * 3. Run the attribute change steps with element, attribute’s local name, + * attribute’s value, null, and attribute’s namespace. + */ + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runAttributeChangeSteps(element, attribute._localName, attribute._value, null, attribute._namespace); + } + /** + * 3. Remove attribute from element’s attribute list. + * 5. Set attribute’s element to null. + */ + var index = element._attributeList._asArray().indexOf(attribute); + element._attributeList._asArray().splice(index, 1); + attribute._element = null; +} +exports.element_remove = element_remove; +/** + * Replaces an attribute with another of an element node. + * + * @param oldAttr - old attribute + * @param newAttr - new attribute + * @param element - an element to receive the attribute + */ +function element_replace(oldAttr, newAttr, element) { + /** + * 1. Queue an attribute mutation record for element with oldAttr’s + * local name, oldAttr’s namespace, and oldAttr’s value. + */ + if (DOMImpl_1.dom.features.mutationObservers) { + MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord(element, oldAttr._localName, oldAttr._namespace, oldAttr._value); + } + /** + * 2. If element is custom, then enqueue a custom element callback reaction + * with element, callback name "attributeChangedCallback", and an argument + * list containing oldAttr’s local name, oldAttr’s value, newAttr’s value, + * and oldAttr’s namespace. + */ + if (DOMImpl_1.dom.features.customElements) { + if (util_1.Guard.isCustomElementNode(element)) { + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(element, "attributeChangedCallback", [oldAttr._localName, oldAttr._value, newAttr._value, oldAttr._namespace]); + } + } + /** + * 3. Run the attribute change steps with element, oldAttr’s local name, + * oldAttr’s value, newAttr’s value, and oldAttr’s namespace. + */ + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runAttributeChangeSteps(element, oldAttr._localName, oldAttr._value, newAttr._value, oldAttr._namespace); + } + /** + * 4. Replace oldAttr by newAttr in element’s attribute list. + * 5. Set oldAttr’s element to null. + * 6. Set newAttr’s element to element. + */ + var index = element._attributeList._asArray().indexOf(oldAttr); + if (index !== -1) { + element._attributeList._asArray()[index] = newAttr; + } + oldAttr._element = null; + newAttr._element = element; + // mark that the document has namespaces + if (!element._nodeDocument._hasNamespaces && (newAttr._namespace !== null || + newAttr._namespacePrefix !== null || newAttr._localName === "xmlns")) { + element._nodeDocument._hasNamespaces = true; + } +} +exports.element_replace = element_replace; +/** + * Retrieves an attribute with the given name from an element node. + * + * @param qualifiedName - an attribute name + * @param element - an element to receive the attribute + */ +function element_getAnAttributeByName(qualifiedName, element) { + /** + * 1. If element is in the HTML namespace and its node document is an HTML + * document, then set qualifiedName to qualifiedName in ASCII lowercase. + * 2. Return the first attribute in element’s attribute list whose qualified + * name is qualifiedName, and null otherwise. + */ + if (element._namespace === infra_1.namespace.HTML && element._nodeDocument._type === "html") { + qualifiedName = qualifiedName.toLowerCase(); + } + return element._attributeList._asArray().find(function (attr) { return attr._qualifiedName === qualifiedName; }) || null; +} +exports.element_getAnAttributeByName = element_getAnAttributeByName; +/** + * Retrieves an attribute with the given namespace and local name from an + * element node. + * + * @param namespace - an attribute namespace + * @param localName - an attribute local name + * @param element - an element to receive the attribute + */ +function element_getAnAttributeByNamespaceAndLocalName(namespace, localName, element) { + /** + * 1. If namespace is the empty string, set it to null. + * 2. Return the attribute in element’s attribute list whose namespace is + * namespace and local name is localName, if any, and null otherwise. + */ + var ns = namespace || null; + return element._attributeList._asArray().find(function (attr) { return attr._namespace === ns && attr._localName === localName; }) || null; +} +exports.element_getAnAttributeByNamespaceAndLocalName = element_getAnAttributeByNamespaceAndLocalName; +/** + * Retrieves an attribute's value with the given name namespace and local + * name from an element node. + * + * @param element - an element to receive the attribute + * @param localName - an attribute local name + * @param namespace - an attribute namespace + */ +function element_getAnAttributeValue(element, localName, namespace) { + if (namespace === void 0) { namespace = ''; } + /** + * 1. Let attr be the result of getting an attribute given namespace, + * localName, and element. + * 2. If attr is null, then return the empty string. + * 3. Return attr’s value. + */ + var attr = element_getAnAttributeByNamespaceAndLocalName(namespace, localName, element); + if (attr === null) + return ''; + else + return attr._value; +} +exports.element_getAnAttributeValue = element_getAnAttributeValue; +/** + * Sets an attribute of an element node. + * + * @param attr - an attribute + * @param element - an element to receive the attribute + */ +function element_setAnAttribute(attr, element) { + /** + * 1. If attr’s element is neither null nor element, throw an + * "InUseAttributeError" DOMException. + * 2. Let oldAttr be the result of getting an attribute given attr’s + * namespace, attr’s local name, and element. + * 3. If oldAttr is attr, return attr. + * 4. If oldAttr is non-null, replace it by attr in element. + * 5. Otherwise, append attr to element. + * 6. Return oldAttr. + */ + if (attr._element !== null && attr._element !== element) + throw new DOMException_1.InUseAttributeError("This attribute already exists in the document: " + attr._qualifiedName + " as a child of " + attr._element._qualifiedName + "."); + var oldAttr = element_getAnAttributeByNamespaceAndLocalName(attr._namespace || '', attr._localName, element); + if (oldAttr === attr) + return attr; + if (oldAttr !== null) { + element_replace(oldAttr, attr, element); + } + else { + element_append(attr, element); + } + return oldAttr; +} +exports.element_setAnAttribute = element_setAnAttribute; +/** + * Sets an attribute's value of an element node. + * + * @param element - an element to receive the attribute + * @param localName - an attribute local name + * @param value - an attribute value + * @param prefix - an attribute prefix + * @param namespace - an attribute namespace + */ +function element_setAnAttributeValue(element, localName, value, prefix, namespace) { + if (prefix === void 0) { prefix = null; } + if (namespace === void 0) { namespace = null; } + /** + * 1. If prefix is not given, set it to null. + * 2. If namespace is not given, set it to null. + * 3. Let attribute be the result of getting an attribute given namespace, + * localName, and element. + * 4. If attribute is null, create an attribute whose namespace is + * namespace, namespace prefix is prefix, local name is localName, value + * is value, and node document is element’s node document, then append this + * attribute to element, and then return. + * 5. Change attribute from element to value. + */ + var attribute = element_getAnAttributeByNamespaceAndLocalName(namespace || '', localName, element); + if (attribute === null) { + var newAttr = CreateAlgorithm_1.create_attr(element._nodeDocument, localName); + newAttr._namespace = namespace; + newAttr._namespacePrefix = prefix; + newAttr._value = value; + element_append(newAttr, element); + return; + } + element_change(attribute, element, value); +} +exports.element_setAnAttributeValue = element_setAnAttributeValue; +/** + * Removes an attribute with the given name from an element node. + * + * @param qualifiedName - an attribute name + * @param element - an element to receive the attribute + */ +function element_removeAnAttributeByName(qualifiedName, element) { + /** + * 1. Let attr be the result of getting an attribute given qualifiedName + * and element. + * 2. If attr is non-null, remove it from element. + * 3. Return attr. + */ + var attr = element_getAnAttributeByName(qualifiedName, element); + if (attr !== null) { + element_remove(attr, element); + } + return attr; +} +exports.element_removeAnAttributeByName = element_removeAnAttributeByName; +/** + * Removes an attribute with the given namespace and local name from an + * element node. + * + * @param namespace - an attribute namespace + * @param localName - an attribute local name + * @param element - an element to receive the attribute + */ +function element_removeAnAttributeByNamespaceAndLocalName(namespace, localName, element) { + /** + * 1. Let attr be the result of getting an attribute given namespace, localName, and element. + * 2. If attr is non-null, remove it from element. + * 3. Return attr. + */ + var attr = element_getAnAttributeByNamespaceAndLocalName(namespace, localName, element); + if (attr !== null) { + element_remove(attr, element); + } + return attr; +} +exports.element_removeAnAttributeByNamespaceAndLocalName = element_removeAnAttributeByNamespaceAndLocalName; +/** + * Creates an element node. + * See: https://dom.spec.whatwg.org/#concept-create-element. + * + * @param document - the document owning the element + * @param localName - local name + * @param namespace - element namespace + * @param prefix - namespace prefix + * @param is - the "is" value + * @param synchronousCustomElementsFlag - synchronous custom elements flag + */ +function element_createAnElement(document, localName, namespace, prefix, is, synchronousCustomElementsFlag) { + if (prefix === void 0) { prefix = null; } + if (is === void 0) { is = null; } + if (synchronousCustomElementsFlag === void 0) { synchronousCustomElementsFlag = false; } + /** + * 1. If prefix was not given, let prefix be null. + * 2. If is was not given, let is be null. + * 3. Let result be null. + */ + var result = null; + if (!DOMImpl_1.dom.features.customElements) { + result = CreateAlgorithm_1.create_element(document, localName, namespace, prefix); + result._customElementState = "uncustomized"; + result._customElementDefinition = null; + result._is = is; + return result; + } + /** + * 4. Let definition be the result of looking up a custom element definition + * given document, namespace, localName, and is. + */ + var definition = CustomElementAlgorithm_1.customElement_lookUpACustomElementDefinition(document, namespace, localName, is); + if (definition !== null && definition.name !== definition.localName) { + /** + * 5. If definition is non-null, and definition’s name is not equal to + * its local name (i.e., definition represents a customized built-in + * element), then: + * 5.1. Let interface be the element interface for localName and the HTML + * namespace. + * 5.2. Set result to a new element that implements interface, with no + * attributes, namespace set to the HTML namespace, namespace prefix + * set to prefix, local name set to localName, custom element state set + * to "undefined", custom element definition set to null, is value set + * to is, and node document set to document. + * 5.3. If the synchronous custom elements flag is set, upgrade element + * using definition. + * 5.4. Otherwise, enqueue a custom element upgrade reaction given result + * and definition. + */ + var elemenInterface = DocumentAlgorithm_1.document_elementInterface(localName, infra_1.namespace.HTML); + result = new elemenInterface(); + result._localName = localName; + result._namespace = infra_1.namespace.HTML; + result._namespacePrefix = prefix; + result._customElementState = "undefined"; + result._customElementDefinition = null; + result._is = is; + result._nodeDocument = document; + if (synchronousCustomElementsFlag) { + CustomElementAlgorithm_1.customElement_upgrade(definition, result); + } + else { + CustomElementAlgorithm_1.customElement_enqueueACustomElementUpgradeReaction(result, definition); + } + } + else if (definition !== null) { + /** + * 6. Otherwise, if definition is non-null, then: + */ + if (synchronousCustomElementsFlag) { + /** + * 6.1. If the synchronous custom elements flag is set, then run these + * steps while catching any exceptions: + */ + try { + /** + * 6.1.1. Let C be definition’s constructor. + * 6.1.2. Set result to the result of constructing C, with no arguments. + * 6.1.3. Assert: result’s custom element state and custom element definition + * are initialized. + * 6.1.4. Assert: result’s namespace is the HTML namespace. + * _Note:_ IDL enforces that result is an HTMLElement object, which all + * use the HTML namespace. + */ + var C = definition.constructor; + var result_1 = new C(); + console.assert(result_1._customElementState !== undefined); + console.assert(result_1._customElementDefinition !== undefined); + console.assert(result_1._namespace === infra_1.namespace.HTML); + /** + * 6.1.5. If result’s attribute list is not empty, then throw a + * "NotSupportedError" DOMException. + * 6.1.6. If result has children, then throw a "NotSupportedError" + * DOMException. + * 6.1.7. If result’s parent is not null, then throw a + * "NotSupportedError" DOMException. + * 6.1.8. If result’s node document is not document, then throw a + * "NotSupportedError" DOMException. + * 6.1.9. If result’s local name is not equal to localName, then throw + * a "NotSupportedError" DOMException. + */ + if (result_1._attributeList.length !== 0) + throw new DOMException_1.NotSupportedError("Custom element already has attributes."); + if (result_1._children.size !== 0) + throw new DOMException_1.NotSupportedError("Custom element already has child nodes."); + if (result_1._parent !== null) + throw new DOMException_1.NotSupportedError("Custom element already has a parent node."); + if (result_1._nodeDocument !== document) + throw new DOMException_1.NotSupportedError("Custom element is already in a document."); + if (result_1._localName !== localName) + throw new DOMException_1.NotSupportedError("Custom element has a different local name."); + /** + * 6.1.10. Set result’s namespace prefix to prefix. + * 6.1.11. Set result’s is value to null. + */ + result_1._namespacePrefix = prefix; + result_1._is = null; + } + catch (e) { + /** + * If any of these steps threw an exception, then: + * - Report the exception. + * - Set result to a new element that implements the HTMLUnknownElement + * interface, with no attributes, namespace set to the HTML namespace, + * namespace prefix set to prefix, local name set to localName, custom + * element state set to "failed", custom element definition set to null, + * is value set to null, and node document set to document. + */ + // TODO: Report the exception + result = CreateAlgorithm_1.create_htmlUnknownElement(document, localName, infra_1.namespace.HTML, prefix); + result._customElementState = "failed"; + result._customElementDefinition = null; + result._is = null; + } + } + else { + /** + * 6.2. Otherwise: + * 6.2.1. Set result to a new element that implements the HTMLElement + * interface, with no attributes, namespace set to the HTML namespace, + * namespace prefix set to prefix, local name set to localName, custom + * element state set to "undefined", custom element definition set to + * null, is value set to null, and node document set to document. + * 6.2.2. Enqueue a custom element upgrade reaction given result and + * definition. + */ + result = CreateAlgorithm_1.create_htmlElement(document, localName, infra_1.namespace.HTML, prefix); + result._customElementState = "undefined"; + result._customElementDefinition = null; + result._is = null; + CustomElementAlgorithm_1.customElement_enqueueACustomElementUpgradeReaction(result, definition); + } + } + else { + /** + * 7. Otherwise: + * 7.1. Let interface be the element interface for localName and + * namespace. + * 7.2. Set result to a new element that implements interface, with no + * attributes, namespace set to namespace, namespace prefix set to prefix, + * local name set to localName, custom element state set to + * "uncustomized", custom element definition set to null, is value set to + * is, and node document set to document. + */ + var elementInterface = DocumentAlgorithm_1.document_elementInterface(localName, namespace); + result = new elementInterface(); + result._localName = localName; + result._namespace = namespace; + result._namespacePrefix = prefix; + result._customElementState = "uncustomized"; + result._customElementDefinition = null; + result._is = is; + result._nodeDocument = document; + /** + * 7.3. If namespace is the HTML namespace, and either localName is a + * valid custom element name or is is non-null, then set result’s + * custom element state to "undefined". + */ + if (namespace === infra_1.namespace.HTML && (is !== null || + CustomElementAlgorithm_1.customElement_isValidCustomElementName(localName))) { + result._customElementState = "undefined"; + } + } + /* istanbul ignore next */ + if (result === null) { + throw new Error("Unable to create element."); + } + /** + * 8. Returns result + */ + return result; +} +exports.element_createAnElement = element_createAnElement; +/** + * Inserts a new node adjacent to this element. + * + * @param element - a reference element + * @param where - a string defining where to insert the element node. + * - `beforebegin` before this element itself. + * - `afterbegin` before the first child. + * - `beforeend` after the last child. + * - `afterend` after this element itself. + * @param node - node to insert + */ +function element_insertAdjacent(element, where, node) { + /** + * - "beforebegin" + * If element’s parent is null, return null. + * Return the result of pre-inserting node into element’s parent before + * element. + * - "afterbegin" + * Return the result of pre-inserting node into element before element’s + * first child. + * - "beforeend" + * Return the result of pre-inserting node into element before null. + * - "afterend" + * If element’s parent is null, return null. + * Return the result of pre-inserting node into element’s parent before element’s next sibling. + * - Otherwise + * Throw a "SyntaxError" DOMException. + */ + switch (where.toLowerCase()) { + case 'beforebegin': + if (element._parent === null) + return null; + return MutationAlgorithm_1.mutation_preInsert(node, element._parent, element); + case 'afterbegin': + return MutationAlgorithm_1.mutation_preInsert(node, element, element._firstChild); + case 'beforeend': + return MutationAlgorithm_1.mutation_preInsert(node, element, null); + case 'afterend': + if (element._parent === null) + return null; + return MutationAlgorithm_1.mutation_preInsert(node, element._parent, element._nextSibling); + default: + throw new DOMException_1.SyntaxError("Invalid 'where' argument. \"beforebegin\", \"afterbegin\", \"beforeend\" or \"afterend\" expected"); + } +} +exports.element_insertAdjacent = element_insertAdjacent; +//# sourceMappingURL=ElementAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/ElementAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/ElementAlgorithm.js.map new file mode 100644 index 0000000..5a154ce --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/ElementAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ElementAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/ElementAlgorithm.ts"],"names":[],"mappings":";;AAAA,0CAAoC;AAEpC,yCAA6D;AAC7D,gCAA+B;AAC/B,oDAAyF;AACzF,qDAE0B;AAC1B,mEAKiC;AACjC,yEAAmF;AACnF,+CAA4D;AAC5D,yDAAwD;AACxD,yDAA+D;AAE/D;;;;;;GAMG;AACH,SA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I,SAAS,KAAK,iBAAc,CAAC,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI;YACnD,+DAAsC,CAAC,SAAS,CAAC,CAAC,EAAE;YACpD,MAAM,CAAC,mBAAmB,GAAG,WAAW,CAAA;SACzC;KACF;IAED,0BAA0B;IAC1B,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;KAC7C;IAED;;OAEG;IACH,OAAO,MAAM,CAAA;AACf,CAAC;AAzLD,0DAyLC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,sBAAsB,CAAC,OAAgB,EACrD,KAA8D,EAC9D,IAAU;IACV;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,KAAK,CAAC,WAAW,EAAE,EAAE;QAC3B,KAAK,aAAa;YAChB,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI;gBAAE,OAAO,IAAI,CAAA;YACzC,OAAO,sCAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAC7C,OAAO,CAAC,CAAA;QACZ,KAAK,YAAY;YACf,OAAO,sCAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;QAC/D,KAAK,WAAW;YACd,OAAO,sCAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;QAChD,KAAK,UAAU;YACb,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI;gBAAE,OAAO,IAAI,CAAA;YACzC,OAAO,sCAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAC7C,OAAO,CAAC,YAAY,CAAC,CAAA;QACzB;YACE,MAAM,IAAI,0BAAW,CAAC,mGAA2F,CAAC,CAAA;KACrH;AACH,CAAC;AAnCD,wDAmCC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/EventAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/EventAlgorithm.d.ts new file mode 100644 index 0000000..895a840 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/EventAlgorithm.d.ts @@ -0,0 +1,146 @@ +import { PotentialEventTarget, EventPathItem, EventListenerEntry, EventHandler, Event, EventTarget } from "../dom/interfaces"; +import { EventImpl } from "../dom/EventImpl"; +/** + * Defines a boolean out variable of a function. + */ +export declare type OutputFlag = { + value: boolean; +}; +/** + * Sets the canceled flag of an event. + * + * @param event - an event + */ +export declare function event_setTheCanceledFlag(event: Event): void; +/** + * Initializes the value of an event. + * + * @param event - an event to initialize + * @param type - the type of event + * @param bubbles - whether the event propagates in reverse + * @param cancelable - whether the event can be cancelled + */ +export declare function event_initialize(event: Event, type: string, bubbles: boolean, cancelable: boolean): void; +/** + * Creates a new event. + * + * @param eventInterface - event interface + * @param realm - realm + */ +export declare function event_createAnEvent(eventInterface: typeof EventImpl, realm?: any | undefined): Event; +/** + * Performs event creation steps. + * + * @param eventInterface - event interface + * @param realm - realm + * @param time - time of occurrance + * @param dictionary - event attributes + * + */ +export declare function event_innerEventCreationSteps(eventInterface: typeof EventImpl, realm: any, time: Date, dictionary: { + [key: string]: any; +}): Event; +/** + * Dispatches an event to an event target. + * + * @param event - the event to dispatch + * @param target - event target + * @param legacyTargetOverrideFlag - legacy target override flag + * @param legacyOutputDidListenersThrowFlag - legacy output flag that returns + * whether the event listener's callback threw an exception + */ +export declare function event_dispatch(event: Event, target: EventTarget, legacyTargetOverrideFlag?: boolean, legacyOutputDidListenersThrowFlag?: OutputFlag): boolean; +/** + * Appends a new struct to an event's path. + * + * @param event - an event + * @param invocationTarget - the target of the invocation + * @param shadowAdjustedTarget - shadow-root adjusted event target + * @param relatedTarget - related event target + * @param touchTargets - a list of touch targets + * @param slotInClosedTree - if the target's parent is a closed shadow root + */ +export declare function event_appendToAnEventPath(event: Event, invocationTarget: EventTarget, shadowAdjustedTarget: PotentialEventTarget, relatedTarget: PotentialEventTarget, touchTargets: PotentialEventTarget[], slotInClosedTree: boolean): void; +/** + * Invokes an event. + * + * @param struct - a struct defining event's path + * @param event - the event to invoke + * @param phase - event phase + * @param legacyOutputDidListenersThrowFlag - legacy output flag that returns + * whether the event listener's callback threw an exception + */ +export declare function event_invoke(struct: EventPathItem, event: Event, phase: "capturing" | "bubbling", legacyOutputDidListenersThrowFlag?: OutputFlag): void; +/** + * Invokes an event. + * + * @param event - the event to invoke + * @param listeners - event listeners + * @param phase - event phase + * @param struct - a struct defining event's path + * @param legacyOutputDidListenersThrowFlag - legacy output flag that returns + * whether the event listener's callback threw an exception + */ +export declare function event_innerInvoke(event: Event, listeners: EventListenerEntry[], phase: "capturing" | "bubbling", struct: EventPathItem, legacyOutputDidListenersThrowFlag?: OutputFlag): boolean; +/** + * Fires an event at target. + * @param e - event name + * @param target - event target + * @param eventConstructor - an event constructor, with a description of how + * IDL attributes are to be initialized + * @param idlAttributes - a dictionary describing how IDL attributes are + * to be initialized + * @param legacyTargetOverrideFlag - legacy target override flag + */ +export declare function event_fireAnEvent(e: string, target: EventTarget, eventConstructor?: typeof EventImpl, idlAttributes?: { + [key: string]: any; +}, legacyTargetOverrideFlag?: boolean): boolean; +/** + * Creates an event. + * + * @param eventInterface - the name of the event interface + */ +export declare function event_createLegacyEvent(eventInterface: string): Event; +/** + * Getter of an event handler IDL attribute. + * + * @param eventTarget - event target + * @param name - event name + */ +export declare function event_getterEventHandlerIDLAttribute(thisObj: EventTarget, name: string): EventHandler; +/** + * Setter of an event handler IDL attribute. + * + * @param eventTarget - event target + * @param name - event name + * @param value - event handler + */ +export declare function event_setterEventHandlerIDLAttribute(thisObj: EventTarget, name: string, value: EventHandler): void; +/** + * Determines the target of an event handler. + * + * @param eventTarget - event target + * @param name - event name + */ +export declare function event_determineTheTargetOfAnEventHandler(eventTarget: EventTarget, name: string): EventTarget | null; +/** + * Gets the current value of an event handler. + * + * @param eventTarget - event target + * @param name - event name + */ +export declare function event_getTheCurrentValueOfAnEventHandler(eventTarget: EventTarget, name: string): EventHandler; +/** + * Activates an event handler. + * + * @param eventTarget - event target + * @param name - event name + */ +export declare function event_activateAnEventHandler(eventTarget: EventTarget, name: string): void; +/** + * Deactivates an event handler. + * + * @param eventTarget - event target + * @param name - event name + */ +export declare function event_deactivateAnEventHandler(eventTarget: EventTarget, name: string): void; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/EventAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/EventAlgorithm.js new file mode 100644 index 0000000..06942e1 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/EventAlgorithm.js @@ -0,0 +1,995 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("../dom/DOMImpl"); +var interfaces_1 = require("../dom/interfaces"); +var util_1 = require("../util"); +var CustomEventImpl_1 = require("../dom/CustomEventImpl"); +var EventImpl_1 = require("../dom/EventImpl"); +var DOMException_1 = require("../dom/DOMException"); +var TreeAlgorithm_1 = require("./TreeAlgorithm"); +var ShadowTreeAlgorithm_1 = require("./ShadowTreeAlgorithm"); +var DOMAlgorithm_1 = require("./DOMAlgorithm"); +/** + * Sets the canceled flag of an event. + * + * @param event - an event + */ +function event_setTheCanceledFlag(event) { + if (event._cancelable && !event._inPassiveListenerFlag) { + event._canceledFlag = true; + } +} +exports.event_setTheCanceledFlag = event_setTheCanceledFlag; +/** + * Initializes the value of an event. + * + * @param event - an event to initialize + * @param type - the type of event + * @param bubbles - whether the event propagates in reverse + * @param cancelable - whether the event can be cancelled + */ +function event_initialize(event, type, bubbles, cancelable) { + event._initializedFlag = true; + event._stopPropagationFlag = false; + event._stopImmediatePropagationFlag = false; + event._canceledFlag = false; + event._isTrusted = false; + event._target = null; + event._type = type; + event._bubbles = bubbles; + event._cancelable = cancelable; +} +exports.event_initialize = event_initialize; +/** + * Creates a new event. + * + * @param eventInterface - event interface + * @param realm - realm + */ +function event_createAnEvent(eventInterface, realm) { + if (realm === void 0) { realm = undefined; } + /** + * 1. If realm is not given, then set it to null. + * 2. Let dictionary be the result of converting the JavaScript value + * undefined to the dictionary type accepted by eventInterface’s + * constructor. (This dictionary type will either be EventInit or a + * dictionary that inherits from it.) + * 3. Let event be the result of running the inner event creation steps with + * eventInterface, realm, the time of the occurrence that the event is + * signaling, and dictionary. + * 4. Initialize event’s isTrusted attribute to true. + * 5. Return event. + */ + if (realm === undefined) + realm = null; + var dictionary = {}; + var event = event_innerEventCreationSteps(eventInterface, realm, new Date(), dictionary); + event._isTrusted = true; + return event; +} +exports.event_createAnEvent = event_createAnEvent; +/** + * Performs event creation steps. + * + * @param eventInterface - event interface + * @param realm - realm + * @param time - time of occurrance + * @param dictionary - event attributes + * + */ +function event_innerEventCreationSteps(eventInterface, realm, time, dictionary) { + /** + * 1. Let event be the result of creating a new object using eventInterface. + * TODO: Implement realms + * If realm is non-null, then use that Realm; otherwise, use the default + * behavior defined in Web IDL. + */ + var event = new eventInterface(""); + /** + * 2. Set event’s initialized flag. + * 3. Initialize event’s timeStamp attribute to a DOMHighResTimeStamp + * representing the high resolution time from the time origin to time. + * 4. For each member → value in dictionary, if event has an attribute + * whose identifier is member, then initialize that attribute to value. + * 5. Run the event constructing steps with event. + * 6. Return event. + */ + event._initializedFlag = true; + event._timeStamp = time.getTime(); + Object.assign(event, dictionary); + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runEventConstructingSteps(event); + } + return event; +} +exports.event_innerEventCreationSteps = event_innerEventCreationSteps; +/** + * Dispatches an event to an event target. + * + * @param event - the event to dispatch + * @param target - event target + * @param legacyTargetOverrideFlag - legacy target override flag + * @param legacyOutputDidListenersThrowFlag - legacy output flag that returns + * whether the event listener's callback threw an exception + */ +function event_dispatch(event, target, legacyTargetOverrideFlag, legacyOutputDidListenersThrowFlag) { + var e_1, _a, e_2, _b; + if (legacyTargetOverrideFlag === void 0) { legacyTargetOverrideFlag = false; } + if (legacyOutputDidListenersThrowFlag === void 0) { legacyOutputDidListenersThrowFlag = { value: false }; } + var clearTargets = false; + /** + * 1. Set event's dispatch flag. + */ + event._dispatchFlag = true; + /** + * 2. Let targetOverride be target, if legacy target override flag is not + * given, and target's associated Document otherwise. + * + * _Note:_ legacy target override flag is only used by HTML and only when + * target is a Window object. + */ + var targetOverride = target; + if (legacyTargetOverrideFlag) { + var doc = target._associatedDocument; + if (util_1.Guard.isDocumentNode(doc)) { + targetOverride = doc; + } + } + /** + * 3. Let activationTarget be null. + * 4. Let relatedTarget be the result of retargeting event's relatedTarget + * against target. + * 5. If target is not relatedTarget or target is event's relatedTarget, + * then: + */ + var activationTarget = null; + var relatedTarget = TreeAlgorithm_1.tree_retarget(event._relatedTarget, target); + if (target !== relatedTarget || target === event._relatedTarget) { + /** + * 5.1. Let touchTargets be a new list. + * 5.2. For each touchTarget of event's touch target list, append the + * result of retargeting touchTarget against target to touchTargets. + * 5.3. Append to an event path with event, target, targetOverride, + * relatedTarget, touchTargets, and false. + * 5.4. Let isActivationEvent be true, if event is a MouseEvent object + * and event's type attribute is "click", and false otherwise. + * 5.5. If isActivationEvent is true and target has activation behavior, + * then set activationTarget to target. + * 5.6. Let slotable be target, if target is a slotable and is assigned, + * and null otherwise. + * 5.7. Let slot-in-closed-tree be false. + * 5.8. Let parent be the result of invoking target's get the parent with + * event. + */ + var touchTargets = []; + try { + for (var _c = __values(event._touchTargetList), _d = _c.next(); !_d.done; _d = _c.next()) { + var touchTarget = _d.value; + touchTargets.push(TreeAlgorithm_1.tree_retarget(touchTarget, target)); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_d && !_d.done && (_a = _c.return)) _a.call(_c); + } + finally { if (e_1) throw e_1.error; } + } + event_appendToAnEventPath(event, target, targetOverride, relatedTarget, touchTargets, false); + var isActivationEvent = (util_1.Guard.isMouseEvent(event) && event._type === "click"); + if (isActivationEvent && target._activationBehavior !== undefined) { + activationTarget = target; + } + var slotable = (util_1.Guard.isSlotable(target) && ShadowTreeAlgorithm_1.shadowTree_isAssigned(target)) ? + target : null; + var slotInClosedTree = false; + var parent = target._getTheParent(event); + /** + * 5.9. While parent is non-null: + */ + while (parent !== null && util_1.Guard.isNode(parent)) { + /** + * 5.9.1 If slotable is non-null: + * 5.9.1.1. Assert: parent is a slot. + * 5.9.1.2. Set slotable to null. + * 5.9.1.3. If parent's root is a shadow root whose mode is "closed", + * then set slot-in-closed-tree to true. + */ + if (slotable !== null) { + if (!util_1.Guard.isSlot(parent)) { + throw new Error("Parent node of a slotable should be a slot."); + } + slotable = null; + var root = TreeAlgorithm_1.tree_rootNode(parent, true); + if (util_1.Guard.isShadowRoot(root) && root._mode === "closed") { + slotInClosedTree = true; + } + } + /** + * 5.9.2 If parent is a slotable and is assigned, then set slotable to + * parent. + * 5.9.3. Let relatedTarget be the result of retargeting event's + * relatedTarget against parent. + * 5.9.4. Let touchTargets be a new list. + * 5.9.4. For each touchTarget of event's touch target list, append the + * result of retargeting touchTarget against parent to touchTargets. + */ + if (util_1.Guard.isSlotable(parent) && ShadowTreeAlgorithm_1.shadowTree_isAssigned(parent)) { + slotable = parent; + } + relatedTarget = TreeAlgorithm_1.tree_retarget(event._relatedTarget, parent); + touchTargets = []; + try { + for (var _e = (e_2 = void 0, __values(event._touchTargetList)), _f = _e.next(); !_f.done; _f = _e.next()) { + var touchTarget = _f.value; + touchTargets.push(TreeAlgorithm_1.tree_retarget(touchTarget, parent)); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_f && !_f.done && (_b = _e.return)) _b.call(_e); + } + finally { if (e_2) throw e_2.error; } + } + /** + * 5.9.6. If parent is a Window object, or parent is a node and target's + * root is a shadow-including inclusive ancestor of parent, then: + */ + if (util_1.Guard.isWindow(parent) || (util_1.Guard.isNode(parent) && util_1.Guard.isNode(target) && + TreeAlgorithm_1.tree_isAncestorOf(TreeAlgorithm_1.tree_rootNode(target, true), parent, true, true))) { + /** + * 5.9.6.1. If isActivationEvent is true, event's bubbles attribute + * is true, activationTarget is null, and parent has activation + * behavior, then set activationTarget to parent. + * 5.9.6.2. Append to an event path with event, parent, null, + * relatedTarget, touchTargets, and slot-in-closed-tree. + */ + if (isActivationEvent && event._bubbles && activationTarget === null && + parent._activationBehavior) { + activationTarget = parent; + } + event_appendToAnEventPath(event, parent, null, relatedTarget, touchTargets, slotInClosedTree); + } + else if (parent === relatedTarget) { + /** + * 5.9.7. Otherwise, if parent is relatedTarget, + * then set parent to null. + */ + parent = null; + } + else { + /** + * 5.9.8. Otherwise, set target to parent and then: + * 5.9.8.1. If isActivationEvent is true, activationTarget is null, + * and target has activation behavior, then set activationTarget + * to target. + * 5.9.8.2. Append to an event path with event, parent, target, + * relatedTarget, touchTargets, and slot-in-closed-tree. + */ + target = parent; + if (isActivationEvent && activationTarget === null && + target._activationBehavior) { + activationTarget = target; + } + event_appendToAnEventPath(event, parent, target, relatedTarget, touchTargets, slotInClosedTree); + } + /** + * 5.9.9. If parent is non-null, then set parent to the result of + * invoking parent's get the parent with event. + * 5.9.10. Set slot-in-closed-tree to false. + */ + if (parent !== null) { + parent = parent._getTheParent(event); + } + slotInClosedTree = false; + } + /** + * 5.10. Let clearTargetsStruct be the last struct in event's path whose + * shadow-adjusted target is non-null. + */ + var clearTargetsStruct = null; + var path = event._path; + for (var i = path.length - 1; i >= 0; i--) { + var struct = path[i]; + if (struct.shadowAdjustedTarget !== null) { + clearTargetsStruct = struct; + break; + } + } + /** + * 5.11. Let clearTargets be true if clearTargetsStruct's shadow-adjusted + * target, clearTargetsStruct's relatedTarget, or an EventTarget object + * in clearTargetsStruct's touch target list is a node and its root is + * a shadow root, and false otherwise. + */ + if (clearTargetsStruct !== null) { + if (util_1.Guard.isNode(clearTargetsStruct.shadowAdjustedTarget) && + util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(clearTargetsStruct.shadowAdjustedTarget, true))) { + clearTargets = true; + } + else if (util_1.Guard.isNode(clearTargetsStruct.relatedTarget) && + util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(clearTargetsStruct.relatedTarget, true))) { + clearTargets = true; + } + else { + for (var j = 0; j < clearTargetsStruct.touchTargetList.length; j++) { + var struct = clearTargetsStruct.touchTargetList[j]; + if (util_1.Guard.isNode(struct) && + util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(struct, true))) { + clearTargets = true; + break; + } + } + } + } + /** + * 5.12. If activationTarget is non-null and activationTarget has + * legacy-pre-activation behavior, then run activationTarget's + * legacy-pre-activation behavior. + */ + if (activationTarget !== null && + activationTarget._legacyPreActivationBehavior !== undefined) { + activationTarget._legacyPreActivationBehavior(event); + } + /** + * 5.13. For each struct in event's path, in reverse order: + */ + for (var i = path.length - 1; i >= 0; i--) { + var struct = path[i]; + /** + * 5.13.1. If struct's shadow-adjusted target is non-null, then set + * event's eventPhase attribute to AT_TARGET. + * 5.13.2. Otherwise, set event's eventPhase attribute to + * CAPTURING_PHASE. + * 5.13.3. Invoke with struct, event, "capturing", and + * legacyOutputDidListenersThrowFlag if given. + */ + if (struct.shadowAdjustedTarget !== null) { + event._eventPhase = interfaces_1.EventPhase.AtTarget; + } + else { + event._eventPhase = interfaces_1.EventPhase.Capturing; + } + event_invoke(struct, event, "capturing", legacyOutputDidListenersThrowFlag); + } + /** + * 5.14. For each struct in event's path + */ + for (var i = 0; i < path.length; i++) { + var struct = path[i]; + /** + * 5.14.1. If struct's shadow-adjusted target is non-null, then set + * event's eventPhase attribute to AT_TARGET. + * 5.14.2. Otherwise: + * 5.14.2.1. If event's bubbles attribute is false, then continue. + * 5.14.2.2. Set event's eventPhase attribute to BUBBLING_PHASE. + * 5.14.3. Invoke with struct, event, "bubbling", and + * legacyOutputDidListenersThrowFlag if given. + */ + if (struct.shadowAdjustedTarget !== null) { + event._eventPhase = interfaces_1.EventPhase.AtTarget; + } + else { + if (!event._bubbles) + continue; + event._eventPhase = interfaces_1.EventPhase.Bubbling; + } + event_invoke(struct, event, "bubbling", legacyOutputDidListenersThrowFlag); + } + } + /** + * 6. Set event's eventPhase attribute to NONE. + * 7. Set event's currentTarget attribute to null. + * 8. Set event's path to the empty list. + * 9. Unset event's dispatch flag, stop propagation flag, and stop + * immediate propagation flag. + */ + event._eventPhase = interfaces_1.EventPhase.None; + event._currentTarget = null; + event._path = []; + event._dispatchFlag = false; + event._stopPropagationFlag = false; + event._stopImmediatePropagationFlag = false; + /** + * 10. If clearTargets, then: + * 10.1. Set event's target to null. + * 10.2. Set event's relatedTarget to null. + * 10.3. Set event's touch target list to the empty list. + */ + if (clearTargets) { + event._target = null; + event._relatedTarget = null; + event._touchTargetList = []; + } + /** + * 11. If activationTarget is non-null, then: + * 11.1. If event's canceled flag is unset, then run activationTarget's + * activation behavior with event. + * 11.2. Otherwise, if activationTarget has legacy-canceled-activation + * behavior, then run activationTarget's legacy-canceled-activation + * behavior. + */ + if (activationTarget !== null) { + if (!event._canceledFlag && activationTarget._activationBehavior !== undefined) { + activationTarget._activationBehavior(event); + } + else if (activationTarget._legacyCanceledActivationBehavior !== undefined) { + activationTarget._legacyCanceledActivationBehavior(event); + } + } + /** + * 12. Return false if event's canceled flag is set, and true otherwise. + */ + return !event._canceledFlag; +} +exports.event_dispatch = event_dispatch; +/** + * Appends a new struct to an event's path. + * + * @param event - an event + * @param invocationTarget - the target of the invocation + * @param shadowAdjustedTarget - shadow-root adjusted event target + * @param relatedTarget - related event target + * @param touchTargets - a list of touch targets + * @param slotInClosedTree - if the target's parent is a closed shadow root + */ +function event_appendToAnEventPath(event, invocationTarget, shadowAdjustedTarget, relatedTarget, touchTargets, slotInClosedTree) { + /** + * 1. Let invocationTargetInShadowTree be false. + * 2. If invocationTarget is a node and its root is a shadow root, then + * set invocationTargetInShadowTree to true. + */ + var invocationTargetInShadowTree = false; + if (util_1.Guard.isNode(invocationTarget) && + util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(invocationTarget))) { + invocationTargetInShadowTree = true; + } + /** + * 3. Let root-of-closed-tree be false. + * 4. If invocationTarget is a shadow root whose mode is "closed", then + * set root-of-closed-tree to true. + */ + var rootOfClosedTree = false; + if (util_1.Guard.isShadowRoot(invocationTarget) && + invocationTarget._mode === "closed") { + rootOfClosedTree = true; + } + /** + * 5. Append a new struct to event's path whose invocation target is + * invocationTarget, invocation-target-in-shadow-tree is + * invocationTargetInShadowTree, shadow-adjusted target is + * shadowAdjustedTarget, relatedTarget is relatedTarget, + * touch target list is touchTargets, root-of-closed-tree is + * root-of-closed-tree, and slot-in-closed-tree is slot-in-closed-tree. + */ + event._path.push({ + invocationTarget: invocationTarget, + invocationTargetInShadowTree: invocationTargetInShadowTree, + shadowAdjustedTarget: shadowAdjustedTarget, + relatedTarget: relatedTarget, + touchTargetList: touchTargets, + rootOfClosedTree: rootOfClosedTree, + slotInClosedTree: slotInClosedTree + }); +} +exports.event_appendToAnEventPath = event_appendToAnEventPath; +/** + * Invokes an event. + * + * @param struct - a struct defining event's path + * @param event - the event to invoke + * @param phase - event phase + * @param legacyOutputDidListenersThrowFlag - legacy output flag that returns + * whether the event listener's callback threw an exception + */ +function event_invoke(struct, event, phase, legacyOutputDidListenersThrowFlag) { + if (legacyOutputDidListenersThrowFlag === void 0) { legacyOutputDidListenersThrowFlag = { value: false }; } + /** + * 1. Set event's target to the shadow-adjusted target of the last struct + * in event's path, that is either struct or preceding struct, whose + * shadow-adjusted target is non-null. + */ + var path = event._path; + var index = -1; + for (var i = 0; i < path.length; i++) { + if (path[i] === struct) { + index = i; + break; + } + } + if (index !== -1) { + var item = path[index]; + if (item.shadowAdjustedTarget !== null) { + event._target = item.shadowAdjustedTarget; + } + else if (index > 0) { + item = path[index - 1]; + if (item.shadowAdjustedTarget !== null) { + event._target = item.shadowAdjustedTarget; + } + } + } + /** + * 2. Set event's relatedTarget to struct's relatedTarget. + * 3. Set event's touch target list to struct's touch target list. + * 4. If event's stop propagation flag is set, then return. + * 5. Initialize event's currentTarget attribute to struct's invocation + * target. + * 6. Let listeners be a clone of event's currentTarget attribute value's + * event listener list. + * + * _Note:_ This avoids event listeners added after this point from being + * run. Note that removal still has an effect due to the removed field. + */ + event._relatedTarget = struct.relatedTarget; + event._touchTargetList = struct.touchTargetList; + if (event._stopPropagationFlag) + return; + event._currentTarget = struct.invocationTarget; + var currentTarget = event._currentTarget; + var targetListeners = currentTarget._eventListenerList; + var listeners = new (Array.bind.apply(Array, __spread([void 0], targetListeners)))(); + /** + * 7. Let found be the result of running inner invoke with event, listeners, + * phase, and legacyOutputDidListenersThrowFlag if given. + */ + var found = event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListenersThrowFlag); + /** + * 8. If found is false and event's isTrusted attribute is true, then: + */ + if (!found && event._isTrusted) { + /** + * 8.1. Let originalEventType be event's type attribute value. + * 8.2. If event's type attribute value is a match for any of the strings + * in the first column in the following table, set event's type attribute + * value to the string in the second column on the same row as the matching + * string, and return otherwise. + * + * Event type | Legacy event type + * ------------------------------------------------- + * "animationend" | "webkitAnimationEnd" + * "animationiteration" | "webkitAnimationIteration" + * "animationstart" | "webkitAnimationStart" + * "transitionend" | "webkitTransitionEnd" + */ + var originalEventType = event._type; + if (originalEventType === "animationend") { + event._type = "webkitAnimationEnd"; + } + else if (originalEventType === "animationiteration") { + event._type = "webkitAnimationIteration"; + } + else if (originalEventType === "animationstart") { + event._type = "webkitAnimationStart"; + } + else if (originalEventType === "transitionend") { + event._type = "webkitTransitionEnd"; + } + /** + * 8.3. Inner invoke with event, listeners, phase, and + * legacyOutputDidListenersThrowFlag if given. + * 8.4. Set event's type attribute value to originalEventType. + */ + event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListenersThrowFlag); + event._type = originalEventType; + } +} +exports.event_invoke = event_invoke; +/** + * Invokes an event. + * + * @param event - the event to invoke + * @param listeners - event listeners + * @param phase - event phase + * @param struct - a struct defining event's path + * @param legacyOutputDidListenersThrowFlag - legacy output flag that returns + * whether the event listener's callback threw an exception + */ +function event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListenersThrowFlag) { + if (legacyOutputDidListenersThrowFlag === void 0) { legacyOutputDidListenersThrowFlag = { value: false }; } + /** + * 1. Let found be false. + * 2. For each listener in listeners, whose removed is false: + */ + var found = false; + for (var i = 0; i < listeners.length; i++) { + var listener = listeners[i]; + if (!listener.removed) { + /** + * 2.1. If event's type attribute value is not listener's type, then + * continue. + * 2.2. Set found to true. + * 2.3. If phase is "capturing" and listener's capture is false, then + * continue. + * 2.4. If phase is "bubbling" and listener's capture is true, then + * continue. + */ + if (event._type !== listener.type) + continue; + found = true; + if (phase === "capturing" && !listener.capture) + continue; + if (phase === "bubbling" && listener.capture) + continue; + /** + * 2.5. If listener's once is true, then remove listener from event's + * currentTarget attribute value's event listener list. + */ + if (listener.once && event._currentTarget !== null) { + var impl = event._currentTarget; + var index = -1; + for (var i_1 = 0; i_1 < impl._eventListenerList.length; i_1++) { + if (impl._eventListenerList[i_1] === listener) { + index = i_1; + break; + } + } + if (index !== -1) { + impl._eventListenerList.splice(index, 1); + } + } + /** + * TODO: Implement realms + * + * 2.6. Let global be listener callback's associated Realm's global + * object. + */ + var globalObject = undefined; + /** + * 2.7. Let currentEvent be undefined. + * 2.8. If global is a Window object, then: + * 2.8.1. Set currentEvent to global's current event. + * 2.8.2. If struct's invocation-target-in-shadow-tree is false, then + * set global's current event to event. + */ + var currentEvent = undefined; + if (util_1.Guard.isWindow(globalObject)) { + currentEvent = globalObject._currentEvent; + if (struct.invocationTargetInShadowTree === false) { + globalObject._currentEvent = event; + } + } + /** + * 2.9. If listener's passive is true, then set event's in passive + * listener flag. + * 2.10. Call a user object's operation with listener's callback, + * "handleEvent", « event », and event's currentTarget attribute value. + */ + if (listener.passive) + event._inPassiveListenerFlag = true; + try { + listener.callback.handleEvent.call(event._currentTarget, event); + } + catch (err) { + /** + * If this throws an exception, then: + * 2.10.1. Report the exception. + * 2.10.2. Set legacyOutputDidListenersThrowFlag if given. + * + * _Note:_ The legacyOutputDidListenersThrowFlag is only used by + * Indexed Database API. + * TODO: Report the exception + * See: https://html.spec.whatwg.org/multipage/webappapis.html#runtime-script-errors-in-documents + */ + legacyOutputDidListenersThrowFlag.value = true; + } + /** + * 2.11. Unset event's in passive listener flag. + */ + if (listener.passive) + event._inPassiveListenerFlag = false; + /** + * 2.12. If global is a Window object, then set global's current event + * to currentEvent. + */ + if (util_1.Guard.isWindow(globalObject)) { + globalObject._currentEvent = currentEvent; + } + /** + * 2.13. If event's stop immediate propagation flag is set, then return + * found. + */ + if (event._stopImmediatePropagationFlag) + return found; + } + } + /** + * 3. Return found. + */ + return found; +} +exports.event_innerInvoke = event_innerInvoke; +/** + * Fires an event at target. + * @param e - event name + * @param target - event target + * @param eventConstructor - an event constructor, with a description of how + * IDL attributes are to be initialized + * @param idlAttributes - a dictionary describing how IDL attributes are + * to be initialized + * @param legacyTargetOverrideFlag - legacy target override flag + */ +function event_fireAnEvent(e, target, eventConstructor, idlAttributes, legacyTargetOverrideFlag) { + /** + * 1. If eventConstructor is not given, then let eventConstructor be Event. + */ + if (eventConstructor === undefined) { + eventConstructor = EventImpl_1.EventImpl; + } + /** + * 2. Let event be the result of creating an event given eventConstructor, + * in the relevant Realm of target. + */ + var event = event_createAnEvent(eventConstructor); + /** + * 3. Initialize event’s type attribute to e. + */ + event._type = e; + /** + * 4. Initialize any other IDL attributes of event as described in the + * invocation of this algorithm. + * _Note:_ This also allows for the isTrusted attribute to be set to false. + */ + if (idlAttributes) { + for (var key in idlAttributes) { + var idlObj = event; + idlObj[key] = idlAttributes[key]; + } + } + /** + * 5. Return the result of dispatching event at target, with legacy target + * override flag set if set. + */ + return event_dispatch(event, target, legacyTargetOverrideFlag); +} +exports.event_fireAnEvent = event_fireAnEvent; +/** + * Creates an event. + * + * @param eventInterface - the name of the event interface + */ +function event_createLegacyEvent(eventInterface) { + /** + * 1. Let constructor be null. + */ + var constructor = null; + /** + * TODO: Implement in HTML DOM + * 2. If interface is an ASCII case-insensitive match for any of the strings + * in the first column in the following table, then set constructor to the + * interface in the second column on the same row as the matching string: + * + * String | Interface + * -------|---------- + * "beforeunloadevent" | BeforeUnloadEvent + * "compositionevent" | CompositionEvent + * "customevent" | CustomEvent + * "devicemotionevent" | DeviceMotionEvent + * "deviceorientationevent" | DeviceOrientationEvent + * "dragevent" | DragEvent + * "event" | Event + * "events" | Event + * "focusevent" | FocusEvent + * "hashchangeevent" | HashChangeEvent + * "htmlevents" | Event + * "keyboardevent" | KeyboardEvent + * "messageevent" | MessageEvent + * "mouseevent" | MouseEvent + * "mouseevents" | + * "storageevent" | StorageEvent + * "svgevents" | Event + * "textevent" | CompositionEvent + * "touchevent" | TouchEvent + * "uievent" | UIEvent + * "uievents" | UIEvent + */ + switch (eventInterface.toLowerCase()) { + case "beforeunloadevent": + break; + case "compositionevent": + break; + case "customevent": + constructor = CustomEventImpl_1.CustomEventImpl; + break; + case "devicemotionevent": + break; + case "deviceorientationevent": + break; + case "dragevent": + break; + case "event": + case "events": + constructor = EventImpl_1.EventImpl; + break; + case "focusevent": + break; + case "hashchangeevent": + break; + case "htmlevents": + break; + case "keyboardevent": + break; + case "messageevent": + break; + case "mouseevent": + break; + case "mouseevents": + break; + case "storageevent": + break; + case "svgevents": + break; + case "textevent": + break; + case "touchevent": + break; + case "uievent": + break; + case "uievents": + break; + } + /** + * 3. If constructor is null, then throw a "NotSupportedError" DOMException. + */ + if (constructor === null) { + throw new DOMException_1.NotSupportedError("Event constructor not found for interface " + eventInterface + "."); + } + /** + * 4. If the interface indicated by constructor is not exposed on the + * relevant global object of the context object, then throw a + * "NotSupportedError" DOMException. + * _Note:_ Typically user agents disable support for touch events in some + * configurations, in which case this clause would be triggered for the + * interface TouchEvent. + */ + // TODO: Implement realms + /** + * 5. Let event be the result of creating an event given constructor. + * 6. Initialize event’s type attribute to the empty string. + * 7. Initialize event’s timeStamp attribute to a DOMHighResTimeStamp + * representing the high resolution time from the time origin to now. + * 8. Initialize event’s isTrusted attribute to false. + * 9. Unset event’s initialized flag. + */ + var event = new constructor(""); + event._type = ""; + event._timeStamp = new Date().getTime(); + event._isTrusted = false; + event._initializedFlag = false; + /** + * 10. Return event. + */ + return event; +} +exports.event_createLegacyEvent = event_createLegacyEvent; +/** + * Getter of an event handler IDL attribute. + * + * @param eventTarget - event target + * @param name - event name + */ +function event_getterEventHandlerIDLAttribute(thisObj, name) { + /** + * 1. Let eventTarget be the result of determining the target of an event + * handler given this object and name. + * 2. If eventTarget is null, then return null. + * 3. Return the result of getting the current value of the event handler + * given eventTarget and name. + */ + var eventTarget = event_determineTheTargetOfAnEventHandler(thisObj, name); + if (eventTarget === null) + return null; + return event_getTheCurrentValueOfAnEventHandler(eventTarget, name); +} +exports.event_getterEventHandlerIDLAttribute = event_getterEventHandlerIDLAttribute; +/** + * Setter of an event handler IDL attribute. + * + * @param eventTarget - event target + * @param name - event name + * @param value - event handler + */ +function event_setterEventHandlerIDLAttribute(thisObj, name, value) { + /** + * 1. Let eventTarget be the result of determining the target of an event + * handler given this object and name. + * 2. If eventTarget is null, then return. + * 3. If the given value is null, then deactivate an event handler given + * eventTarget and name. + * 4. Otherwise: + * 4.1. Let handlerMap be eventTarget's event handler map. + * 4.2. Let eventHandler be handlerMap[name]. + * 4.3. Set eventHandler's value to the given value. + * 4.4. Activate an event handler given eventTarget and name. + */ + var eventTarget = event_determineTheTargetOfAnEventHandler(thisObj, name); + if (eventTarget === null) + return; + if (value === null) { + event_deactivateAnEventHandler(eventTarget, name); + } + else { + var handlerMap = eventTarget._eventHandlerMap; + var eventHandler = handlerMap["onabort"]; + if (eventHandler !== undefined) { + eventHandler.value = value; + } + event_activateAnEventHandler(eventTarget, name); + } +} +exports.event_setterEventHandlerIDLAttribute = event_setterEventHandlerIDLAttribute; +/** + * Determines the target of an event handler. + * + * @param eventTarget - event target + * @param name - event name + */ +function event_determineTheTargetOfAnEventHandler(eventTarget, name) { + // TODO: Implement in HTML DOM + return null; +} +exports.event_determineTheTargetOfAnEventHandler = event_determineTheTargetOfAnEventHandler; +/** + * Gets the current value of an event handler. + * + * @param eventTarget - event target + * @param name - event name + */ +function event_getTheCurrentValueOfAnEventHandler(eventTarget, name) { + // TODO: Implement in HTML DOM + return null; +} +exports.event_getTheCurrentValueOfAnEventHandler = event_getTheCurrentValueOfAnEventHandler; +/** + * Activates an event handler. + * + * @param eventTarget - event target + * @param name - event name + */ +function event_activateAnEventHandler(eventTarget, name) { + // TODO: Implement in HTML DOM +} +exports.event_activateAnEventHandler = event_activateAnEventHandler; +/** + * Deactivates an event handler. + * + * @param eventTarget - event target + * @param name - event name + */ +function event_deactivateAnEventHandler(eventTarget, name) { + // TODO: Implement in HTML DOM +} +exports.event_deactivateAnEventHandler = event_deactivateAnEventHandler; +//# sourceMappingURL=EventAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/EventAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/EventAlgorithm.js.map new file mode 100644 index 0000000..7263816 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/EventAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"EventAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/EventAlgorithm.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAoC;AACpC,gDAG0B;AAC1B,gCAA+B;AAC/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CAAA;IAChB,IAAI,WAAW,KAAK,IAAI;QAAE,OAAM;IAChC,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,8BAA8B,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;KAClD;SAAM;QACL,IAAM,UAAU,GAAG,WAAW,CAAC,gBAAgB,CAAA;QAC/C,IAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,CAAA;QAC1C,IAAI,YAAY,KAAK,SAAS,EAAE;YAC9B,YAAY,CAAC,KAAK,GAAG,KAAK,CAAA;SAC3B;QACD,4BAA4B,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;KAChD;AACH,CAAC;AA3BD,oFA2BC;AAED;;;;;GAKG;AACH,SAAgB,wCAAwC,CAAC,WAAwB,EAC/E,IAAY;IACZ,8BAA8B;IAC9B,OAAO,IAAI,CAAA;AACb,CAAC;AAJD,4FAIC;AAED;;;;;GAKG;AACH,SAAgB,wCAAwC,CAAC,WAAwB,EAC/E,IAAY;IACZ,8BAA8B;IAC9B,OAAO,IAAI,CAAA;AACb,CAAC;AAJD,4FAIC;AAED;;;;;GAKG;AACH,SAAgB,4BAA4B,CAAC,WAAwB,EACnE,IAAY;IACZ,8BAA8B;AAChC,CAAC;AAHD,oEAGC;AAED;;;;;GAKG;AACH,SAAgB,8BAA8B,CAAC,WAAwB,EACrE,IAAY;IACZ,8BAA8B;AAChC,CAAC;AAHD,wEAGC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/EventTargetAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/EventTargetAlgorithm.d.ts new file mode 100644 index 0000000..6f749b7 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/EventTargetAlgorithm.d.ts @@ -0,0 +1,33 @@ +import { EventListenerOptions, AddEventListenerOptions, EventListenerEntry, EventTarget } from "../dom/interfaces"; +/** + * Flattens the given options argument. + * + * @param options - options argument + */ +export declare function eventTarget_flatten(options: EventListenerOptions | boolean): boolean; +/** + * Flattens the given options argument. + * + * @param options - options argument + */ +export declare function eventTarget_flattenMore(options: AddEventListenerOptions | boolean): [boolean, boolean, boolean]; +/** + * Adds a new event listener. + * + * @param eventTarget - event target + * @param listener - event listener + */ +export declare function eventTarget_addEventListener(eventTarget: EventTarget, listener: EventListenerEntry): void; +/** + * Removes an event listener. + * + * @param eventTarget - event target + * @param listener - event listener + */ +export declare function eventTarget_removeEventListener(eventTarget: EventTarget, listener: EventListenerEntry, index: number): void; +/** + * Removes all event listeners. + * + * @param eventTarget - event target + */ +export declare function eventTarget_removeAllEventListeners(eventTarget: EventTarget): void; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/EventTargetAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/EventTargetAlgorithm.js new file mode 100644 index 0000000..12e4076 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/EventTargetAlgorithm.js @@ -0,0 +1,142 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var util_1 = require("@oozcitak/util"); +/** + * Flattens the given options argument. + * + * @param options - options argument + */ +function eventTarget_flatten(options) { + /** + * 1. If options is a boolean, then return options. + * 2. Return options’s capture. + */ + if (util_1.isBoolean(options)) { + return options; + } + else { + return options.capture || false; + } +} +exports.eventTarget_flatten = eventTarget_flatten; +/** + * Flattens the given options argument. + * + * @param options - options argument + */ +function eventTarget_flattenMore(options) { + /** + * 1. Let capture be the result of flattening options. + * 2. Let once and passive be false. + * 3. If options is a dictionary, then set passive to options’s passive and + * once to options’s once. + * 4. Return capture, passive, and once. + */ + var capture = eventTarget_flatten(options); + var once = false; + var passive = false; + if (!util_1.isBoolean(options)) { + once = options.once || false; + passive = options.passive || false; + } + return [capture, passive, once]; +} +exports.eventTarget_flattenMore = eventTarget_flattenMore; +/** + * Adds a new event listener. + * + * @param eventTarget - event target + * @param listener - event listener + */ +function eventTarget_addEventListener(eventTarget, listener) { + /** + * 1. If eventTarget is a ServiceWorkerGlobalScope object, its service + * worker’s script resource’s has ever been evaluated flag is set, and + * listener’s type matches the type attribute value of any of the service + * worker events, then report a warning to the console that this might not + * give the expected results. [SERVICE-WORKERS] + */ + // TODO: service worker + /** + * 2. If listener’s callback is null, then return. + */ + if (listener.callback === null) + return; + /** + * 3. If eventTarget’s event listener list does not contain an event listener + * whose type is listener’s type, callback is listener’s callback, and capture + * is listener’s capture, then append listener to eventTarget’s event listener + * list. + */ + for (var i = 0; i < eventTarget._eventListenerList.length; i++) { + var entry = eventTarget._eventListenerList[i]; + if (entry.type === listener.type && entry.callback.handleEvent === listener.callback.handleEvent + && entry.capture === listener.capture) { + return; + } + } + eventTarget._eventListenerList.push(listener); +} +exports.eventTarget_addEventListener = eventTarget_addEventListener; +/** + * Removes an event listener. + * + * @param eventTarget - event target + * @param listener - event listener + */ +function eventTarget_removeEventListener(eventTarget, listener, index) { + /** + * 1. If eventTarget is a ServiceWorkerGlobalScope object and its service + * worker’s set of event types to handle contains type, then report a + * warning to the console that this might not give the expected results. + * [SERVICE-WORKERS] + */ + // TODO: service worker + /** + * 2. Set listener’s removed to true and remove listener from eventTarget’s + * event listener list. + */ + listener.removed = true; + eventTarget._eventListenerList.splice(index, 1); +} +exports.eventTarget_removeEventListener = eventTarget_removeEventListener; +/** + * Removes all event listeners. + * + * @param eventTarget - event target + */ +function eventTarget_removeAllEventListeners(eventTarget) { + /** + * To remove all event listeners, given an EventTarget object eventTarget, + * for each listener of eventTarget’s event listener list, remove an event + * listener with eventTarget and listener. + */ + var e_1, _a; + try { + for (var _b = __values(eventTarget._eventListenerList), _c = _b.next(); !_c.done; _c = _b.next()) { + var e = _c.value; + e.removed = true; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + eventTarget._eventListenerList.length = 0; +} +exports.eventTarget_removeAllEventListeners = eventTarget_removeAllEventListeners; +//# sourceMappingURL=EventTargetAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/EventTargetAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/EventTargetAlgorithm.js.map new file mode 100644 index 0000000..911ef05 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/EventTargetAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"EventTargetAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/EventTargetAlgorithm.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAGA,uCAA0C;AAE1C;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,OAAuC;IACzE;;;OAGG;IACH,IAAI,gBAAS,CAAC,OAAO,CAAC,EAAE;QACtB,OAAO,OAAO,CAAA;KACf;SAAM;QACL,OAAO,OAAO,CAAC,OAAO,IAAI,KAAK,CAAA;KAChC;AACH,CAAC;AAVD,kDAUC;AAED;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,OAA0C;IAChF;;;;;;OAMG;IACH,IAAM,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAA;IAC5C,IAAI,IAAI,GAAG,KAAK,CAAA;IAChB,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,IAAI,CAAC,gBAAS,CAAC,OAAO,CAAC,EAAE;QACvB,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,KAAK,CAAA;QAC5B,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,KAAK,CAAA;KACnC;IACD,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;AACjC,CAAC;AAhBD,0DAgBC;AAED;;;;;GAKG;AACH,SAAgB,4BAA4B,CA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/lib/algorithm/MutationAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/MutationAlgorithm.d.ts new file mode 100644 index 0000000..cdb1b80 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/MutationAlgorithm.d.ts @@ -0,0 +1,66 @@ +import { Node } from "../dom/interfaces"; +/** + * Ensures pre-insertion validity of a node into a parent before a + * child. + * + * @param node - node to insert + * @param parent - parent node to receive node + * @param child - child node to insert node before + */ +export declare function mutation_ensurePreInsertionValidity(node: Node, parent: Node, child: Node | null): void; +/** + * Ensures pre-insertion validity of a node into a parent before a + * child, then adopts the node to the tree and inserts it. + * + * @param node - node to insert + * @param parent - parent node to receive node + * @param child - child node to insert node before + */ +export declare function mutation_preInsert(node: Node, parent: Node, child: Node | null): Node; +/** + * Inserts a node into a parent node before the given child node. + * + * @param node - node to insert + * @param parent - parent node to receive node + * @param child - child node to insert node before + * @param suppressObservers - whether to notify observers + */ +export declare function mutation_insert(node: Node, parent: Node, child: Node | null, suppressObservers?: boolean): void; +/** + * Appends a node to the children of a parent node. + * + * @param node - a node + * @param parent - the parent to receive node + */ +export declare function mutation_append(node: Node, parent: Node): Node; +/** + * Replaces a node with another node. + * + * @param child - child node to remove + * @param node - node to insert + * @param parent - parent node to receive node + */ +export declare function mutation_replace(child: Node, node: Node, parent: Node): Node; +/** + * Replaces all nodes of a parent with the given node. + * + * @param node - node to insert + * @param parent - parent node to receive node + */ +export declare function mutation_replaceAll(node: Node | null, parent: Node): void; +/** + * Ensures pre-removal validity of a child node from a parent, then + * removes it. + * + * @param child - child node to remove + * @param parent - parent node + */ +export declare function mutation_preRemove(child: Node, parent: Node): Node; +/** + * Removes a child node from its parent. + * + * @param node - node to remove + * @param parent - parent node + * @param suppressObservers - whether to notify observers + */ +export declare function mutation_remove(node: Node, parent: Node, suppressObservers?: boolean): void; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/MutationAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/MutationAlgorithm.js new file mode 100644 index 0000000..8960b60 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/MutationAlgorithm.js @@ -0,0 +1,1173 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("../dom/DOMImpl"); +var DOMException_1 = require("../dom/DOMException"); +var interfaces_1 = require("../dom/interfaces"); +var util_1 = require("../util"); +var util_2 = require("@oozcitak/util"); +var infra_1 = require("@oozcitak/infra"); +var CustomElementAlgorithm_1 = require("./CustomElementAlgorithm"); +var TreeAlgorithm_1 = require("./TreeAlgorithm"); +var NodeIteratorAlgorithm_1 = require("./NodeIteratorAlgorithm"); +var ShadowTreeAlgorithm_1 = require("./ShadowTreeAlgorithm"); +var MutationObserverAlgorithm_1 = require("./MutationObserverAlgorithm"); +var DOMAlgorithm_1 = require("./DOMAlgorithm"); +var DocumentAlgorithm_1 = require("./DocumentAlgorithm"); +/** + * Ensures pre-insertion validity of a node into a parent before a + * child. + * + * @param node - node to insert + * @param parent - parent node to receive node + * @param child - child node to insert node before + */ +function mutation_ensurePreInsertionValidity(node, parent, child) { + var e_1, _a, e_2, _b, e_3, _c, e_4, _d; + var parentNodeType = parent._nodeType; + var nodeNodeType = node._nodeType; + var childNodeType = child ? child._nodeType : null; + /** + * 1. If parent is not a Document, DocumentFragment, or Element node, + * throw a "HierarchyRequestError" DOMException. + */ + if (parentNodeType !== interfaces_1.NodeType.Document && + parentNodeType !== interfaces_1.NodeType.DocumentFragment && + parentNodeType !== interfaces_1.NodeType.Element) + throw new DOMException_1.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is " + parent.nodeName + "."); + /** + * 2. If node is a host-including inclusive ancestor of parent, throw a + * "HierarchyRequestError" DOMException. + */ + if (TreeAlgorithm_1.tree_isHostIncludingAncestorOf(parent, node, true)) + throw new DOMException_1.HierarchyRequestError("The node to be inserted cannot be an inclusive ancestor of parent node. Node is " + node.nodeName + ", parent node is " + parent.nodeName + "."); + /** + * 3. If child is not null and its parent is not parent, then throw a + * "NotFoundError" DOMException. + */ + if (child !== null && child._parent !== parent) + throw new DOMException_1.NotFoundError("The reference child node cannot be found under parent node. Child node is " + child.nodeName + ", parent node is " + parent.nodeName + "."); + /** + * 4. If node is not a DocumentFragment, DocumentType, Element, Text, + * ProcessingInstruction, or Comment node, throw a "HierarchyRequestError" + * DOMException. + */ + if (nodeNodeType !== interfaces_1.NodeType.DocumentFragment && + nodeNodeType !== interfaces_1.NodeType.DocumentType && + nodeNodeType !== interfaces_1.NodeType.Element && + nodeNodeType !== interfaces_1.NodeType.Text && + nodeNodeType !== interfaces_1.NodeType.ProcessingInstruction && + nodeNodeType !== interfaces_1.NodeType.CData && + nodeNodeType !== interfaces_1.NodeType.Comment) + throw new DOMException_1.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is " + node.nodeName + "."); + /** + * 5. If either node is a Text node and parent is a document, or node is a + * doctype and parent is not a document, throw a "HierarchyRequestError" + * DOMException. + */ + if (nodeNodeType === interfaces_1.NodeType.Text && + parentNodeType === interfaces_1.NodeType.Document) + throw new DOMException_1.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is " + node.nodeName + "."); + if (nodeNodeType === interfaces_1.NodeType.DocumentType && + parentNodeType !== interfaces_1.NodeType.Document) + throw new DOMException_1.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is " + parent.nodeName + "."); + /** + * 6. If parent is a document, and any of the statements below, switched on + * node, are true, throw a "HierarchyRequestError" DOMException. + * - DocumentFragment node + * If node has more than one element child or has a Text node child. + * Otherwise, if node has one element child and either parent has an element + * child, child is a doctype, or child is not null and a doctype is + * following child. + * - element + * parent has an element child, child is a doctype, or child is not null and + * a doctype is following child. + * - doctype + * parent has a doctype child, child is non-null and an element is preceding + * child, or child is null and parent has an element child. + */ + if (parentNodeType === interfaces_1.NodeType.Document) { + if (nodeNodeType === interfaces_1.NodeType.DocumentFragment) { + var eleCount = 0; + try { + for (var _e = __values(node._children), _f = _e.next(); !_f.done; _f = _e.next()) { + var childNode = _f.value; + if (childNode._nodeType === interfaces_1.NodeType.Element) + eleCount++; + else if (childNode._nodeType === interfaces_1.NodeType.Text) + throw new DOMException_1.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is " + childNode.nodeName + "."); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_f && !_f.done && (_a = _e.return)) _a.call(_e); + } + finally { if (e_1) throw e_1.error; } + } + if (eleCount > 1) { + throw new DOMException_1.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has " + eleCount + " element nodes."); + } + else if (eleCount === 1) { + try { + for (var _g = __values(parent._children), _h = _g.next(); !_h.done; _h = _g.next()) { + var ele = _h.value; + if (ele._nodeType === interfaces_1.NodeType.Element) + throw new DOMException_1.HierarchyRequestError("The document node already has a document element node."); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_h && !_h.done && (_b = _g.return)) _b.call(_g); + } + finally { if (e_2) throw e_2.error; } + } + if (child) { + if (childNodeType === interfaces_1.NodeType.DocumentType) + throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node."); + var doctypeChild = child._nextSibling; + while (doctypeChild) { + if (doctypeChild._nodeType === interfaces_1.NodeType.DocumentType) + throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node."); + doctypeChild = doctypeChild._nextSibling; + } + } + } + } + else if (nodeNodeType === interfaces_1.NodeType.Element) { + try { + for (var _j = __values(parent._children), _k = _j.next(); !_k.done; _k = _j.next()) { + var ele = _k.value; + if (ele._nodeType === interfaces_1.NodeType.Element) + throw new DOMException_1.HierarchyRequestError("Document already has a document element node. Node is " + node.nodeName + "."); + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (_k && !_k.done && (_c = _j.return)) _c.call(_j); + } + finally { if (e_3) throw e_3.error; } + } + if (child) { + if (childNodeType === interfaces_1.NodeType.DocumentType) + throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node. Node is " + node.nodeName + "."); + var doctypeChild = child._nextSibling; + while (doctypeChild) { + if (doctypeChild._nodeType === interfaces_1.NodeType.DocumentType) + throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node. Node is " + node.nodeName + "."); + doctypeChild = doctypeChild._nextSibling; + } + } + } + else if (nodeNodeType === interfaces_1.NodeType.DocumentType) { + try { + for (var _l = __values(parent._children), _m = _l.next(); !_m.done; _m = _l.next()) { + var ele = _m.value; + if (ele._nodeType === interfaces_1.NodeType.DocumentType) + throw new DOMException_1.HierarchyRequestError("Document already has a document type node. Node is " + node.nodeName + "."); + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (_m && !_m.done && (_d = _l.return)) _d.call(_l); + } + finally { if (e_4) throw e_4.error; } + } + if (child) { + var elementChild = child._previousSibling; + while (elementChild) { + if (elementChild._nodeType === interfaces_1.NodeType.Element) + throw new DOMException_1.HierarchyRequestError("Cannot insert a document type node before an element node. Node is " + node.nodeName + "."); + elementChild = elementChild._previousSibling; + } + } + else { + var elementChild = parent._firstChild; + while (elementChild) { + if (elementChild._nodeType === interfaces_1.NodeType.Element) + throw new DOMException_1.HierarchyRequestError("Cannot insert a document type node before an element node. Node is " + node.nodeName + "."); + elementChild = elementChild._nextSibling; + } + } + } + } +} +exports.mutation_ensurePreInsertionValidity = mutation_ensurePreInsertionValidity; +/** + * Ensures pre-insertion validity of a node into a parent before a + * child, then adopts the node to the tree and inserts it. + * + * @param node - node to insert + * @param parent - parent node to receive node + * @param child - child node to insert node before + */ +function mutation_preInsert(node, parent, child) { + /** + * 1. Ensure pre-insertion validity of node into parent before child. + * 2. Let reference child be child. + * 3. If reference child is node, set it to node’s next sibling. + * 4. Adopt node into parent’s node document. + * 5. Insert node into parent before reference child. + * 6. Return node. + */ + mutation_ensurePreInsertionValidity(node, parent, child); + var referenceChild = child; + if (referenceChild === node) + referenceChild = node._nextSibling; + DocumentAlgorithm_1.document_adopt(node, parent._nodeDocument); + mutation_insert(node, parent, referenceChild); + return node; +} +exports.mutation_preInsert = mutation_preInsert; +/** + * Inserts a node into a parent node before the given child node. + * + * @param node - node to insert + * @param parent - parent node to receive node + * @param child - child node to insert node before + * @param suppressObservers - whether to notify observers + */ +function mutation_insert(node, parent, child, suppressObservers) { + var e_5, _a; + // Optimized common case + if (child === null && node._nodeType !== interfaces_1.NodeType.DocumentFragment) { + mutation_insert_single(node, parent, suppressObservers); + return; + } + /** + * 1. Let count be the number of children of node if it is a + * DocumentFragment node, and one otherwise. + */ + var count = (node._nodeType === interfaces_1.NodeType.DocumentFragment ? + node._children.size : 1); + /** + * 2. If child is non-null, then: + */ + if (child !== null) { + /** + * 2.1. For each live range whose start node is parent and start + * offset is greater than child's index, increase its start + * offset by count. + * 2.2. For each live range whose end node is parent and end + * offset is greater than child's index, increase its end + * offset by count. + */ + if (DOMImpl_1.dom.rangeList.size !== 0) { + var index_1 = TreeAlgorithm_1.tree_index(child); + try { + for (var _b = __values(DOMImpl_1.dom.rangeList), _c = _b.next(); !_c.done; _c = _b.next()) { + var range = _c.value; + if (range._start[0] === parent && range._start[1] > index_1) { + range._start[1] += count; + } + if (range._end[0] === parent && range._end[1] > index_1) { + range._end[1] += count; + } + } + } + catch (e_5_1) { e_5 = { error: e_5_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_5) throw e_5.error; } + } + } + } + /** + * 3. Let nodes be node’s children, if node is a DocumentFragment node; + * otherwise « node ». + */ + var nodes = node._nodeType === interfaces_1.NodeType.DocumentFragment ? new (Array.bind.apply(Array, __spread([void 0], node._children)))() : [node]; + /** + * 4. If node is a DocumentFragment node, remove its children with the + * suppress observers flag set. + */ + if (node._nodeType === interfaces_1.NodeType.DocumentFragment) { + while (node._firstChild) { + mutation_remove(node._firstChild, node, true); + } + } + /** + * 5. If node is a DocumentFragment node, then queue a tree mutation record + * for node with « », nodes, null, and null. + */ + if (DOMImpl_1.dom.features.mutationObservers) { + if (node._nodeType === interfaces_1.NodeType.DocumentFragment) { + MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(node, [], nodes, null, null); + } + } + /** + * 6. Let previousSibling be child’s previous sibling or parent’s last + * child if child is null. + */ + var previousSibling = (child ? child._previousSibling : parent._lastChild); + var index = child === null ? -1 : TreeAlgorithm_1.tree_index(child); + /** + * 7. For each node in nodes, in tree order: + */ + for (var i = 0; i < nodes.length; i++) { + var node_1 = nodes[i]; + if (util_1.Guard.isElementNode(node_1)) { + // set document element node + if (util_1.Guard.isDocumentNode(parent)) { + parent._documentElement = node_1; + } + // mark that the document has namespaces + if (!node_1._nodeDocument._hasNamespaces && (node_1._namespace !== null || + node_1._namespacePrefix !== null)) { + node_1._nodeDocument._hasNamespaces = true; + } + } + /** + * 7.1. If child is null, then append node to parent’s children. + * 7.2. Otherwise, insert node into parent’s children before child’s + * index. + */ + node_1._parent = parent; + if (child === null) { + infra_1.set.append(parent._children, node_1); + } + else { + infra_1.set.insert(parent._children, node_1, index); + index++; + } + // assign siblings and children for quick lookups + if (parent._firstChild === null) { + node_1._previousSibling = null; + node_1._nextSibling = null; + parent._firstChild = node_1; + parent._lastChild = node_1; + } + else { + var prev = (child ? child._previousSibling : parent._lastChild); + var next = (child ? child : null); + node_1._previousSibling = prev; + node_1._nextSibling = next; + if (prev) + prev._nextSibling = node_1; + if (next) + next._previousSibling = node_1; + if (!prev) + parent._firstChild = node_1; + if (!next) + parent._lastChild = node_1; + } + /** + * 7.3. If parent is a shadow host and node is a slotable, then + * assign a slot for node. + */ + if (DOMImpl_1.dom.features.slots) { + if (parent._shadowRoot !== null && util_1.Guard.isSlotable(node_1)) { + ShadowTreeAlgorithm_1.shadowTree_assignASlot(node_1); + } + } + /** + * 7.4. If node is a Text node, run the child text content change + * steps for parent. + */ + if (DOMImpl_1.dom.features.steps) { + if (util_1.Guard.isTextNode(node_1)) { + DOMAlgorithm_1.dom_runChildTextContentChangeSteps(parent); + } + } + /** + * 7.5. If parent's root is a shadow root, and parent is a slot + * whose assigned nodes is the empty list, then run signal + * a slot change for parent. + */ + if (DOMImpl_1.dom.features.slots) { + if (util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(parent)) && + util_1.Guard.isSlot(parent) && util_2.isEmpty(parent._assignedNodes)) { + ShadowTreeAlgorithm_1.shadowTree_signalASlotChange(parent); + } + } + /** + * 7.6. Run assign slotables for a tree with node's root. + */ + if (DOMImpl_1.dom.features.slots) { + ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(TreeAlgorithm_1.tree_rootNode(node_1)); + } + /** + * 7.7. For each shadow-including inclusive descendant + * inclusiveDescendant of node, in shadow-including tree + * order: + */ + var inclusiveDescendant = TreeAlgorithm_1.tree_getFirstDescendantNode(node_1, true, true); + while (inclusiveDescendant !== null) { + /** + * 7.7.1. Run the insertion steps with inclusiveDescendant. + */ + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runInsertionSteps(inclusiveDescendant); + } + if (DOMImpl_1.dom.features.customElements) { + /** + * 7.7.2. If inclusiveDescendant is connected, then: + */ + if (util_1.Guard.isElementNode(inclusiveDescendant) && + ShadowTreeAlgorithm_1.shadowTree_isConnected(inclusiveDescendant)) { + if (util_1.Guard.isCustomElementNode(inclusiveDescendant)) { + /** + * 7.7.2.1. If inclusiveDescendant is custom, then enqueue a custom + * element callback reaction with inclusiveDescendant, callback name + * "connectedCallback", and an empty argument list. + */ + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(inclusiveDescendant, "connectedCallback", []); + } + else { + /** + * 7.7.2.2. Otherwise, try to upgrade inclusiveDescendant. + */ + CustomElementAlgorithm_1.customElement_tryToUpgrade(inclusiveDescendant); + } + } + } + inclusiveDescendant = TreeAlgorithm_1.tree_getNextDescendantNode(node_1, inclusiveDescendant, true, true); + } + } + /** + * 8. If suppress observers flag is unset, then queue a tree mutation record + * for parent with nodes, « », previousSibling, and child. + */ + if (DOMImpl_1.dom.features.mutationObservers) { + if (!suppressObservers) { + MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, nodes, [], previousSibling, child); + } + } +} +exports.mutation_insert = mutation_insert; +/** + * Inserts a node into a parent node. Optimized routine for the common case where + * node is not a document fragment node and it has no child nodes. + * + * @param node - node to insert + * @param parent - parent node to receive node + * @param suppressObservers - whether to notify observers + */ +function mutation_insert_single(node, parent, suppressObservers) { + /** + * 1. Let count be the number of children of node if it is a + * DocumentFragment node, and one otherwise. + * 2. If child is non-null, then: + * 2.1. For each live range whose start node is parent and start + * offset is greater than child's index, increase its start + * offset by count. + * 2.2. For each live range whose end node is parent and end + * offset is greater than child's index, increase its end + * offset by count. + * 3. Let nodes be node’s children, if node is a DocumentFragment node; + * otherwise « node ». + * 4. If node is a DocumentFragment node, remove its children with the + * suppress observers flag set. + * 5. If node is a DocumentFragment node, then queue a tree mutation record + * for node with « », nodes, null, and null. + */ + /** + * 6. Let previousSibling be child’s previous sibling or parent’s last + * child if child is null. + */ + var previousSibling = parent._lastChild; + // set document element node + if (util_1.Guard.isElementNode(node)) { + // set document element node + if (util_1.Guard.isDocumentNode(parent)) { + parent._documentElement = node; + } + // mark that the document has namespaces + if (!node._nodeDocument._hasNamespaces && (node._namespace !== null || + node._namespacePrefix !== null)) { + node._nodeDocument._hasNamespaces = true; + } + } + /** + * 7. For each node in nodes, in tree order: + * 7.1. If child is null, then append node to parent’s children. + * 7.2. Otherwise, insert node into parent’s children before child’s + * index. + */ + node._parent = parent; + parent._children.add(node); + // assign siblings and children for quick lookups + if (parent._firstChild === null) { + node._previousSibling = null; + node._nextSibling = null; + parent._firstChild = node; + parent._lastChild = node; + } + else { + var prev = parent._lastChild; + node._previousSibling = prev; + node._nextSibling = null; + if (prev) + prev._nextSibling = node; + if (!prev) + parent._firstChild = node; + parent._lastChild = node; + } + /** + * 7.3. If parent is a shadow host and node is a slotable, then + * assign a slot for node. + */ + if (DOMImpl_1.dom.features.slots) { + if (parent._shadowRoot !== null && util_1.Guard.isSlotable(node)) { + ShadowTreeAlgorithm_1.shadowTree_assignASlot(node); + } + } + /** + * 7.4. If node is a Text node, run the child text content change + * steps for parent. + */ + if (DOMImpl_1.dom.features.steps) { + if (util_1.Guard.isTextNode(node)) { + DOMAlgorithm_1.dom_runChildTextContentChangeSteps(parent); + } + } + /** + * 7.5. If parent's root is a shadow root, and parent is a slot + * whose assigned nodes is the empty list, then run signal + * a slot change for parent. + */ + if (DOMImpl_1.dom.features.slots) { + if (util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(parent)) && + util_1.Guard.isSlot(parent) && util_2.isEmpty(parent._assignedNodes)) { + ShadowTreeAlgorithm_1.shadowTree_signalASlotChange(parent); + } + } + /** + * 7.6. Run assign slotables for a tree with node's root. + */ + if (DOMImpl_1.dom.features.slots) { + ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(TreeAlgorithm_1.tree_rootNode(node)); + } + /** + * 7.7. For each shadow-including inclusive descendant + * inclusiveDescendant of node, in shadow-including tree + * order: + * 7.7.1. Run the insertion steps with inclusiveDescendant. + */ + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runInsertionSteps(node); + } + if (DOMImpl_1.dom.features.customElements) { + /** + * 7.7.2. If inclusiveDescendant is connected, then: + */ + if (util_1.Guard.isElementNode(node) && + ShadowTreeAlgorithm_1.shadowTree_isConnected(node)) { + if (util_1.Guard.isCustomElementNode(node)) { + /** + * 7.7.2.1. If inclusiveDescendant is custom, then enqueue a custom + * element callback reaction with inclusiveDescendant, callback name + * "connectedCallback", and an empty argument list. + */ + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(node, "connectedCallback", []); + } + else { + /** + * 7.7.2.2. Otherwise, try to upgrade inclusiveDescendant. + */ + CustomElementAlgorithm_1.customElement_tryToUpgrade(node); + } + } + } + /** + * 8. If suppress observers flag is unset, then queue a tree mutation record + * for parent with nodes, « », previousSibling, and child. + */ + if (DOMImpl_1.dom.features.mutationObservers) { + if (!suppressObservers) { + MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, [node], [], previousSibling, null); + } + } +} +/** + * Appends a node to the children of a parent node. + * + * @param node - a node + * @param parent - the parent to receive node + */ +function mutation_append(node, parent) { + /** + * To append a node to a parent, pre-insert node into parent before null. + */ + return mutation_preInsert(node, parent, null); +} +exports.mutation_append = mutation_append; +/** + * Replaces a node with another node. + * + * @param child - child node to remove + * @param node - node to insert + * @param parent - parent node to receive node + */ +function mutation_replace(child, node, parent) { + var e_6, _a, e_7, _b, e_8, _c, e_9, _d; + /** + * 1. If parent is not a Document, DocumentFragment, or Element node, + * throw a "HierarchyRequestError" DOMException. + */ + if (parent._nodeType !== interfaces_1.NodeType.Document && + parent._nodeType !== interfaces_1.NodeType.DocumentFragment && + parent._nodeType !== interfaces_1.NodeType.Element) + throw new DOMException_1.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is " + parent.nodeName + "."); + /** + * 2. If node is a host-including inclusive ancestor of parent, throw a + * "HierarchyRequestError" DOMException. + */ + if (TreeAlgorithm_1.tree_isHostIncludingAncestorOf(parent, node, true)) + throw new DOMException_1.HierarchyRequestError("The node to be inserted cannot be an ancestor of parent node. Node is " + node.nodeName + ", parent node is " + parent.nodeName + "."); + /** + * 3. If child’s parent is not parent, then throw a "NotFoundError" + * DOMException. + */ + if (child._parent !== parent) + throw new DOMException_1.NotFoundError("The reference child node cannot be found under parent node. Child node is " + child.nodeName + ", parent node is " + parent.nodeName + "."); + /** + * 4. If node is not a DocumentFragment, DocumentType, Element, Text, + * ProcessingInstruction, or Comment node, throw a "HierarchyRequestError" + * DOMException. + */ + if (node._nodeType !== interfaces_1.NodeType.DocumentFragment && + node._nodeType !== interfaces_1.NodeType.DocumentType && + node._nodeType !== interfaces_1.NodeType.Element && + node._nodeType !== interfaces_1.NodeType.Text && + node._nodeType !== interfaces_1.NodeType.ProcessingInstruction && + node._nodeType !== interfaces_1.NodeType.CData && + node._nodeType !== interfaces_1.NodeType.Comment) + throw new DOMException_1.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is " + node.nodeName + "."); + /** + * 5. If either node is a Text node and parent is a document, or node is a + * doctype and parent is not a document, throw a "HierarchyRequestError" + * DOMException. + */ + if (node._nodeType === interfaces_1.NodeType.Text && + parent._nodeType === interfaces_1.NodeType.Document) + throw new DOMException_1.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is " + node.nodeName + "."); + if (node._nodeType === interfaces_1.NodeType.DocumentType && + parent._nodeType !== interfaces_1.NodeType.Document) + throw new DOMException_1.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is " + parent.nodeName + "."); + /** + * 6. If parent is a document, and any of the statements below, switched on + * node, are true, throw a "HierarchyRequestError" DOMException. + * - DocumentFragment node + * If node has more than one element child or has a Text node child. + * Otherwise, if node has one element child and either parent has an element + * child that is not child or a doctype is following child. + * - element + * parent has an element child that is not child or a doctype is + * following child. + * - doctype + * parent has a doctype child that is not child, or an element is + * preceding child. + */ + if (parent._nodeType === interfaces_1.NodeType.Document) { + if (node._nodeType === interfaces_1.NodeType.DocumentFragment) { + var eleCount = 0; + try { + for (var _e = __values(node._children), _f = _e.next(); !_f.done; _f = _e.next()) { + var childNode = _f.value; + if (childNode._nodeType === interfaces_1.NodeType.Element) + eleCount++; + else if (childNode._nodeType === interfaces_1.NodeType.Text) + throw new DOMException_1.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is " + childNode.nodeName + "."); + } + } + catch (e_6_1) { e_6 = { error: e_6_1 }; } + finally { + try { + if (_f && !_f.done && (_a = _e.return)) _a.call(_e); + } + finally { if (e_6) throw e_6.error; } + } + if (eleCount > 1) { + throw new DOMException_1.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has " + eleCount + " element nodes."); + } + else if (eleCount === 1) { + try { + for (var _g = __values(parent._children), _h = _g.next(); !_h.done; _h = _g.next()) { + var ele = _h.value; + if (ele._nodeType === interfaces_1.NodeType.Element && ele !== child) + throw new DOMException_1.HierarchyRequestError("The document node already has a document element node."); + } + } + catch (e_7_1) { e_7 = { error: e_7_1 }; } + finally { + try { + if (_h && !_h.done && (_b = _g.return)) _b.call(_g); + } + finally { if (e_7) throw e_7.error; } + } + var doctypeChild = child._nextSibling; + while (doctypeChild) { + if (doctypeChild._nodeType === interfaces_1.NodeType.DocumentType) + throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node."); + doctypeChild = doctypeChild._nextSibling; + } + } + } + else if (node._nodeType === interfaces_1.NodeType.Element) { + try { + for (var _j = __values(parent._children), _k = _j.next(); !_k.done; _k = _j.next()) { + var ele = _k.value; + if (ele._nodeType === interfaces_1.NodeType.Element && ele !== child) + throw new DOMException_1.HierarchyRequestError("Document already has a document element node. Node is " + node.nodeName + "."); + } + } + catch (e_8_1) { e_8 = { error: e_8_1 }; } + finally { + try { + if (_k && !_k.done && (_c = _j.return)) _c.call(_j); + } + finally { if (e_8) throw e_8.error; } + } + var doctypeChild = child._nextSibling; + while (doctypeChild) { + if (doctypeChild._nodeType === interfaces_1.NodeType.DocumentType) + throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node. Node is " + node.nodeName + "."); + doctypeChild = doctypeChild._nextSibling; + } + } + else if (node._nodeType === interfaces_1.NodeType.DocumentType) { + try { + for (var _l = __values(parent._children), _m = _l.next(); !_m.done; _m = _l.next()) { + var ele = _m.value; + if (ele._nodeType === interfaces_1.NodeType.DocumentType && ele !== child) + throw new DOMException_1.HierarchyRequestError("Document already has a document type node. Node is " + node.nodeName + "."); + } + } + catch (e_9_1) { e_9 = { error: e_9_1 }; } + finally { + try { + if (_m && !_m.done && (_d = _l.return)) _d.call(_l); + } + finally { if (e_9) throw e_9.error; } + } + var elementChild = child._previousSibling; + while (elementChild) { + if (elementChild._nodeType === interfaces_1.NodeType.Element) + throw new DOMException_1.HierarchyRequestError("Cannot insert a document type node before an element node. Node is " + node.nodeName + "."); + elementChild = elementChild._previousSibling; + } + } + } + /** + * 7. Let reference child be child’s next sibling. + * 8. If reference child is node, set it to node’s next sibling. + * 8. Let previousSibling be child’s previous sibling. + */ + var referenceChild = child._nextSibling; + if (referenceChild === node) + referenceChild = node._nextSibling; + var previousSibling = child._previousSibling; + /** + * 10. Adopt node into parent’s node document. + * 11. Let removedNodes be the empty list. + */ + DocumentAlgorithm_1.document_adopt(node, parent._nodeDocument); + var removedNodes = []; + /** + * 12. If child’s parent is not null, then: + */ + if (child._parent !== null) { + /** + * 12.1. Set removedNodes to [child]. + * 12.2. Remove child from its parent with the suppress observers flag + * set. + */ + removedNodes.push(child); + mutation_remove(child, child._parent, true); + } + /** + * 13. Let nodes be node’s children if node is a DocumentFragment node; + * otherwise [node]. + */ + var nodes = []; + if (node._nodeType === interfaces_1.NodeType.DocumentFragment) { + nodes = Array.from(node._children); + } + else { + nodes.push(node); + } + /** + * 14. Insert node into parent before reference child with the suppress + * observers flag set. + */ + mutation_insert(node, parent, referenceChild, true); + /** + * 15. Queue a tree mutation record for parent with nodes, removedNodes, + * previousSibling, and reference child. + */ + if (DOMImpl_1.dom.features.mutationObservers) { + MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, nodes, removedNodes, previousSibling, referenceChild); + } + /** + * 16. Return child. + */ + return child; +} +exports.mutation_replace = mutation_replace; +/** + * Replaces all nodes of a parent with the given node. + * + * @param node - node to insert + * @param parent - parent node to receive node + */ +function mutation_replaceAll(node, parent) { + var e_10, _a; + /** + * 1. If node is not null, adopt node into parent’s node document. + */ + if (node !== null) { + DocumentAlgorithm_1.document_adopt(node, parent._nodeDocument); + } + /** + * 2. Let removedNodes be parent’s children. + */ + var removedNodes = Array.from(parent._children); + /** + * 3. Let addedNodes be the empty list. + * 4. If node is DocumentFragment node, then set addedNodes to node’s + * children. + * 5. Otherwise, if node is non-null, set addedNodes to [node]. + */ + var addedNodes = []; + if (node && node._nodeType === interfaces_1.NodeType.DocumentFragment) { + addedNodes = Array.from(node._children); + } + else if (node !== null) { + addedNodes.push(node); + } + try { + /** + * 6. Remove all parent’s children, in tree order, with the suppress + * observers flag set. + */ + for (var removedNodes_1 = __values(removedNodes), removedNodes_1_1 = removedNodes_1.next(); !removedNodes_1_1.done; removedNodes_1_1 = removedNodes_1.next()) { + var childNode = removedNodes_1_1.value; + mutation_remove(childNode, parent, true); + } + } + catch (e_10_1) { e_10 = { error: e_10_1 }; } + finally { + try { + if (removedNodes_1_1 && !removedNodes_1_1.done && (_a = removedNodes_1.return)) _a.call(removedNodes_1); + } + finally { if (e_10) throw e_10.error; } + } + /** + * 7. If node is not null, then insert node into parent before null with the + * suppress observers flag set. + */ + if (node !== null) { + mutation_insert(node, parent, null, true); + } + /** + * 8. Queue a tree mutation record for parent with addedNodes, removedNodes, + * null, and null. + */ + if (DOMImpl_1.dom.features.mutationObservers) { + MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, addedNodes, removedNodes, null, null); + } +} +exports.mutation_replaceAll = mutation_replaceAll; +/** + * Ensures pre-removal validity of a child node from a parent, then + * removes it. + * + * @param child - child node to remove + * @param parent - parent node + */ +function mutation_preRemove(child, parent) { + /** + * 1. If child’s parent is not parent, then throw a "NotFoundError" + * DOMException. + * 2. Remove child from parent. + * 3. Return child. + */ + if (child._parent !== parent) + throw new DOMException_1.NotFoundError("The child node cannot be found under parent node. Child node is " + child.nodeName + ", parent node is " + parent.nodeName + "."); + mutation_remove(child, parent); + return child; +} +exports.mutation_preRemove = mutation_preRemove; +/** + * Removes a child node from its parent. + * + * @param node - node to remove + * @param parent - parent node + * @param suppressObservers - whether to notify observers + */ +function mutation_remove(node, parent, suppressObservers) { + var e_11, _a, e_12, _b, e_13, _c, e_14, _d; + if (DOMImpl_1.dom.rangeList.size !== 0) { + /** + * 1. Let index be node’s index. + */ + var index = TreeAlgorithm_1.tree_index(node); + try { + /** + * 2. For each live range whose start node is an inclusive descendant of + * node, set its start to (parent, index). + * 3. For each live range whose end node is an inclusive descendant of + * node, set its end to (parent, index). + */ + for (var _e = __values(DOMImpl_1.dom.rangeList), _f = _e.next(); !_f.done; _f = _e.next()) { + var range = _f.value; + if (TreeAlgorithm_1.tree_isDescendantOf(node, range._start[0], true)) { + range._start = [parent, index]; + } + if (TreeAlgorithm_1.tree_isDescendantOf(node, range._end[0], true)) { + range._end = [parent, index]; + } + if (range._start[0] === parent && range._start[1] > index) { + range._start[1]--; + } + if (range._end[0] === parent && range._end[1] > index) { + range._end[1]--; + } + } + } + catch (e_11_1) { e_11 = { error: e_11_1 }; } + finally { + try { + if (_f && !_f.done && (_a = _e.return)) _a.call(_e); + } + finally { if (e_11) throw e_11.error; } + } + try { + /** + * 4. For each live range whose start node is parent and start offset is + * greater than index, decrease its start offset by 1. + * 5. For each live range whose end node is parent and end offset is greater + * than index, decrease its end offset by 1. + */ + for (var _g = __values(DOMImpl_1.dom.rangeList), _h = _g.next(); !_h.done; _h = _g.next()) { + var range = _h.value; + if (range._start[0] === parent && range._start[1] > index) { + range._start[1] -= 1; + } + if (range._end[0] === parent && range._end[1] > index) { + range._end[1] -= 1; + } + } + } + catch (e_12_1) { e_12 = { error: e_12_1 }; } + finally { + try { + if (_h && !_h.done && (_b = _g.return)) _b.call(_g); + } + finally { if (e_12) throw e_12.error; } + } + } + /** + * 6. For each NodeIterator object iterator whose root’s node document is + * node’s node document, run the NodeIterator pre-removing steps given node + * and iterator. + */ + if (DOMImpl_1.dom.features.steps) { + try { + for (var _j = __values(NodeIteratorAlgorithm_1.nodeIterator_iteratorList()), _k = _j.next(); !_k.done; _k = _j.next()) { + var iterator = _k.value; + if (iterator._root._nodeDocument === node._nodeDocument) { + DOMAlgorithm_1.dom_runNodeIteratorPreRemovingSteps(iterator, node); + } + } + } + catch (e_13_1) { e_13 = { error: e_13_1 }; } + finally { + try { + if (_k && !_k.done && (_c = _j.return)) _c.call(_j); + } + finally { if (e_13) throw e_13.error; } + } + } + /** + * 7. Let oldPreviousSibling be node’s previous sibling. + * 8. Let oldNextSibling be node’s next sibling. + */ + var oldPreviousSibling = node._previousSibling; + var oldNextSibling = node._nextSibling; + // set document element node + if (util_1.Guard.isDocumentNode(parent) && util_1.Guard.isElementNode(node)) { + parent._documentElement = null; + } + /** + * 9. Remove node from its parent’s children. + */ + node._parent = null; + parent._children.delete(node); + // assign siblings and children for quick lookups + var prev = node._previousSibling; + var next = node._nextSibling; + node._previousSibling = null; + node._nextSibling = null; + if (prev) + prev._nextSibling = next; + if (next) + next._previousSibling = prev; + if (!prev) + parent._firstChild = next; + if (!next) + parent._lastChild = prev; + /** + * 10. If node is assigned, then run assign slotables for node’s assigned + * slot. + */ + if (DOMImpl_1.dom.features.slots) { + if (util_1.Guard.isSlotable(node) && node._assignedSlot !== null && ShadowTreeAlgorithm_1.shadowTree_isAssigned(node)) { + ShadowTreeAlgorithm_1.shadowTree_assignSlotables(node._assignedSlot); + } + } + /** + * 11. If parent’s root is a shadow root, and parent is a slot whose + * assigned nodes is the empty list, then run signal a slot change for + * parent. + */ + if (DOMImpl_1.dom.features.slots) { + if (util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(parent)) && + util_1.Guard.isSlot(parent) && util_2.isEmpty(parent._assignedNodes)) { + ShadowTreeAlgorithm_1.shadowTree_signalASlotChange(parent); + } + } + /** + * 12. If node has an inclusive descendant that is a slot, then: + * 12.1. Run assign slotables for a tree with parent's root. + * 12.2. Run assign slotables for a tree with node. + */ + if (DOMImpl_1.dom.features.slots) { + var descendant_1 = TreeAlgorithm_1.tree_getFirstDescendantNode(node, true, false, function (e) { return util_1.Guard.isSlot(e); }); + if (descendant_1 !== null) { + ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(TreeAlgorithm_1.tree_rootNode(parent)); + ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(node); + } + } + /** + * 13. Run the removing steps with node and parent. + */ + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runRemovingSteps(node, parent); + } + /** + * 14. If node is custom, then enqueue a custom element callback + * reaction with node, callback name "disconnectedCallback", + * and an empty argument list. + */ + if (DOMImpl_1.dom.features.customElements) { + if (util_1.Guard.isCustomElementNode(node)) { + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(node, "disconnectedCallback", []); + } + } + /** + * 15. For each shadow-including descendant descendant of node, + * in shadow-including tree order, then: + */ + var descendant = TreeAlgorithm_1.tree_getFirstDescendantNode(node, false, true); + while (descendant !== null) { + /** + * 15.1. Run the removing steps with descendant. + */ + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runRemovingSteps(descendant, node); + } + /** + * 15.2. If descendant is custom, then enqueue a custom element + * callback reaction with descendant, callback name + * "disconnectedCallback", and an empty argument list. + */ + if (DOMImpl_1.dom.features.customElements) { + if (util_1.Guard.isCustomElementNode(descendant)) { + CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(descendant, "disconnectedCallback", []); + } + } + descendant = TreeAlgorithm_1.tree_getNextDescendantNode(node, descendant, false, true); + } + /** + * 16. For each inclusive ancestor inclusiveAncestor of parent, and + * then for each registered of inclusiveAncestor's registered + * observer list, if registered's options's subtree is true, + * then append a new transient registered observer whose + * observer is registered's observer, options is registered's + * options, and source is registered to node's registered + * observer list. + */ + if (DOMImpl_1.dom.features.mutationObservers) { + var inclusiveAncestor = TreeAlgorithm_1.tree_getFirstAncestorNode(parent, true); + while (inclusiveAncestor !== null) { + try { + for (var _l = (e_14 = void 0, __values(inclusiveAncestor._registeredObserverList)), _m = _l.next(); !_m.done; _m = _l.next()) { + var registered = _m.value; + if (registered.options.subtree) { + node._registeredObserverList.push({ + observer: registered.observer, + options: registered.options, + source: registered + }); + } + } + } + catch (e_14_1) { e_14 = { error: e_14_1 }; } + finally { + try { + if (_m && !_m.done && (_d = _l.return)) _d.call(_l); + } + finally { if (e_14) throw e_14.error; } + } + inclusiveAncestor = TreeAlgorithm_1.tree_getNextAncestorNode(parent, inclusiveAncestor, true); + } + } + /** + * 17. If suppress observers flag is unset, then queue a tree mutation + * record for parent with « », « node », oldPreviousSibling, and + * oldNextSibling. + */ + if (DOMImpl_1.dom.features.mutationObservers) { + if (!suppressObservers) { + MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, [], [node], oldPreviousSibling, oldNextSibling); + } + } + /** + * 18. If node is a Text node, then run the child text content change steps + * for parent. + */ + if (DOMImpl_1.dom.features.steps) { + if (util_1.Guard.isTextNode(node)) { + DOMAlgorithm_1.dom_runChildTextContentChangeSteps(parent); + } + } +} +exports.mutation_remove = mutation_remove; +//# sourceMappingURL=MutationAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/MutationAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/MutationAlgorithm.js.map new file mode 100644 index 0000000..6f494ea --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/MutationAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MutationAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/MutationAlgorithm.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAoC;AACpC,oDAA0E;AAC1E,gDAA2D;AAC3D,gC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AAC,OAAO;4BAC3B,MAAM,EAAE,UAAU;yBACnB,CAAC,CAAA;qBACH;iBACF;;;;;;;;;YACD,iBAAiB,GAAG,wCAAwB,CAAC,MAAM,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAA;SAC9E;KACF;IAED;;;;OAIG;IACH,IAAI,aAAG,CAAC,QAAQ,CAAC,iBAAiB,EAAE;QAClC,IAAI,CAAC,iBAAiB,EAAE;YACtB,4DAAgC,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EACjD,kBAAkB,EAAE,cAAc,CAAC,CAAA;SACtC;KACF;IAED;;;OAGG;IACH,IAAI,aAAG,CAAC,QAAQ,CAAC,KAAK,EAAE;QACtB,IAAI,YAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;YAC1B,iDAAkC,CAAC,MAAM,CAAC,CAAA;SAC3C;KACF;AACH,CAAC;AAzND,0CAyNC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/MutationObserverAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/MutationObserverAlgorithm.d.ts new file mode 100644 index 0000000..3104944 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/MutationObserverAlgorithm.d.ts @@ -0,0 +1,43 @@ +import { Node } from "../dom/interfaces"; +/** + * Queues a mutation observer microtask to the surrounding agent’s mutation + * observers. + */ +export declare function observer_queueAMutationObserverMicrotask(): void; +/** + * Notifies the surrounding agent’s mutation observers. + */ +export declare function observer_notifyMutationObservers(): void; +/** + * Queues a mutation record of the given type for target. + * + * @param type - mutation record type + * @param target - target node + * @param name - name before mutation + * @param namespace - namespace before mutation + * @param oldValue - attribute value before mutation + * @param addedNodes - a list od added nodes + * @param removedNodes - a list of removed nodes + * @param previousSibling - previous sibling of target before mutation + * @param nextSibling - next sibling of target before mutation + */ +export declare function observer_queueMutationRecord(type: "attributes" | "characterData" | "childList", target: Node, name: string | null, namespace: string | null, oldValue: string | null, addedNodes: Node[], removedNodes: Node[], previousSibling: Node | null, nextSibling: Node | null): void; +/** + * Queues a tree mutation record for target. + * + * @param target - target node + * @param addedNodes - a list od added nodes + * @param removedNodes - a list of removed nodes + * @param previousSibling - previous sibling of target before mutation + * @param nextSibling - next sibling of target before mutation + */ +export declare function observer_queueTreeMutationRecord(target: Node, addedNodes: Node[], removedNodes: Node[], previousSibling: Node | null, nextSibling: Node | null): void; +/** + * Queues an attribute mutation record for target. + * + * @param target - target node + * @param name - name before mutation + * @param namespace - namespace before mutation + * @param oldValue - attribute value before mutation + */ +export declare function observer_queueAttributeMutationRecord(target: Node, name: string | null, namespace: string | null, oldValue: string | null): void; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/MutationObserverAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/MutationObserverAlgorithm.js new file mode 100644 index 0000000..99314a3 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/MutationObserverAlgorithm.js @@ -0,0 +1,276 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("../dom/DOMImpl"); +var util_1 = require("../util"); +var infra_1 = require("@oozcitak/infra"); +var CreateAlgorithm_1 = require("./CreateAlgorithm"); +var TreeAlgorithm_1 = require("./TreeAlgorithm"); +var EventAlgorithm_1 = require("./EventAlgorithm"); +/** + * Queues a mutation observer microtask to the surrounding agent’s mutation + * observers. + */ +function observer_queueAMutationObserverMicrotask() { + /** + * 1. If the surrounding agent’s mutation observer microtask queued is true, + * then return. + * 2. Set the surrounding agent’s mutation observer microtask queued to true. + * 3. Queue a microtask to notify mutation observers. + */ + var window = DOMImpl_1.dom.window; + if (window._mutationObserverMicrotaskQueued) + return; + window._mutationObserverMicrotaskQueued = true; + Promise.resolve().then(function () { observer_notifyMutationObservers(); }); +} +exports.observer_queueAMutationObserverMicrotask = observer_queueAMutationObserverMicrotask; +/** + * Notifies the surrounding agent’s mutation observers. + */ +function observer_notifyMutationObservers() { + var e_1, _a, e_2, _b; + /** + * 1. Set the surrounding agent’s mutation observer microtask queued to false. + * 2. Let notifySet be a clone of the surrounding agent’s mutation observers. + * 3. Let signalSet be a clone of the surrounding agent’s signal slots. + * 4. Empty the surrounding agent’s signal slots. + */ + var window = DOMImpl_1.dom.window; + window._mutationObserverMicrotaskQueued = false; + var notifySet = infra_1.set.clone(window._mutationObservers); + var signalSet = infra_1.set.clone(window._signalSlots); + infra_1.set.empty(window._signalSlots); + var _loop_1 = function (mo) { + /** + * 5.1. Let records be a clone of mo’s record queue. + * 5.2. Empty mo’s record queue. + */ + var records = infra_1.list.clone(mo._recordQueue); + infra_1.list.empty(mo._recordQueue); + /** + * 5.3. For each node of mo’s node list, remove all transient registered + * observers whose observer is mo from node’s registered observer list. + */ + for (var i = 0; i < mo._nodeList.length; i++) { + var node = mo._nodeList[i]; + infra_1.list.remove(node._registeredObserverList, function (observer) { + return util_1.Guard.isTransientRegisteredObserver(observer) && observer.observer === mo; + }); + } + /** + * 5.4. If records is not empty, then invoke mo’s callback with « records, + * mo », and mo. If this throws an exception, then report the exception. + */ + if (!infra_1.list.isEmpty(records)) { + try { + mo._callback.call(mo, records, mo); + } + catch (err) { + // TODO: Report the exception + } + } + }; + try { + /** + * 5. For each mo of notifySet: + */ + for (var notifySet_1 = __values(notifySet), notifySet_1_1 = notifySet_1.next(); !notifySet_1_1.done; notifySet_1_1 = notifySet_1.next()) { + var mo = notifySet_1_1.value; + _loop_1(mo); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (notifySet_1_1 && !notifySet_1_1.done && (_a = notifySet_1.return)) _a.call(notifySet_1); + } + finally { if (e_1) throw e_1.error; } + } + /** + * 6. For each slot of signalSet, fire an event named slotchange, with its + * bubbles attribute set to true, at slot. + */ + if (DOMImpl_1.dom.features.slots) { + try { + for (var signalSet_1 = __values(signalSet), signalSet_1_1 = signalSet_1.next(); !signalSet_1_1.done; signalSet_1_1 = signalSet_1.next()) { + var slot = signalSet_1_1.value; + EventAlgorithm_1.event_fireAnEvent("slotchange", slot, undefined, { bubbles: true }); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (signalSet_1_1 && !signalSet_1_1.done && (_b = signalSet_1.return)) _b.call(signalSet_1); + } + finally { if (e_2) throw e_2.error; } + } + } +} +exports.observer_notifyMutationObservers = observer_notifyMutationObservers; +/** + * Queues a mutation record of the given type for target. + * + * @param type - mutation record type + * @param target - target node + * @param name - name before mutation + * @param namespace - namespace before mutation + * @param oldValue - attribute value before mutation + * @param addedNodes - a list od added nodes + * @param removedNodes - a list of removed nodes + * @param previousSibling - previous sibling of target before mutation + * @param nextSibling - next sibling of target before mutation + */ +function observer_queueMutationRecord(type, target, name, namespace, oldValue, addedNodes, removedNodes, previousSibling, nextSibling) { + var e_3, _a; + /** + * 1. Let interestedObservers be an empty map. + * 2. Let nodes be the inclusive ancestors of target. + * 3. For each node in nodes, and then for each registered of node’s + * registered observer list: + */ + var interestedObservers = new Map(); + var node = TreeAlgorithm_1.tree_getFirstAncestorNode(target, true); + while (node !== null) { + for (var i = 0; i < node._registeredObserverList.length; i++) { + var registered = node._registeredObserverList[i]; + /** + * 3.1. Let options be registered’s options. + * 3.2. If none of the following are true + * - node is not target and options’s subtree is false + * - type is "attributes" and options’s attributes is not true + * - type is "attributes", options’s attributeFilter is present, and + * options’s attributeFilter does not contain name or namespace is + * non-null + * - type is "characterData" and options’s characterData is not true + * - type is "childList" and options’s childList is false + */ + var options = registered.options; + if (node !== target && !options.subtree) + continue; + if (type === "attributes" && !options.attributes) + continue; + if (type === "attributes" && options.attributeFilter && + (!options.attributeFilter.indexOf(name || '') || namespace !== null)) + continue; + if (type === "characterData" && !options.characterData) + continue; + if (type === "childList" && !options.childList) + continue; + /** + * then: + * 3.2.1. Let mo be registered’s observer. + * 3.2.2. If interestedObservers[mo] does not exist, then set + * interestedObservers[mo] to null. + * 3.2.3. If either type is "attributes" and options’s attributeOldValue + * is true, or type is "characterData" and options’s + * characterDataOldValue is true, then set interestedObservers[mo] + * to oldValue. + */ + var mo = registered.observer; + if (!interestedObservers.has(mo)) { + interestedObservers.set(mo, null); + } + if ((type === "attributes" && options.attributeOldValue) || + (type === "characterData" && options.characterDataOldValue)) { + interestedObservers.set(mo, oldValue); + } + } + node = TreeAlgorithm_1.tree_getNextAncestorNode(target, node, true); + } + try { + /** + * 4. For each observer → mappedOldValue of interestedObservers: + */ + for (var interestedObservers_1 = __values(interestedObservers), interestedObservers_1_1 = interestedObservers_1.next(); !interestedObservers_1_1.done; interestedObservers_1_1 = interestedObservers_1.next()) { + var _b = __read(interestedObservers_1_1.value, 2), observer = _b[0], mappedOldValue = _b[1]; + /** + * 4.1. Let record be a new MutationRecord object with its type set to + * type, target set to target, attributeName set to name, + * attributeNamespace set to namespace, oldValue set to mappedOldValue, + * addedNodes set to addedNodes, removedNodes set to removedNodes, + * previousSibling set to previousSibling, and nextSibling set to + * nextSibling. + * 4.2. Enqueue record to observer’s record queue. + */ + var record = CreateAlgorithm_1.create_mutationRecord(type, target, CreateAlgorithm_1.create_nodeListStatic(target, addedNodes), CreateAlgorithm_1.create_nodeListStatic(target, removedNodes), previousSibling, nextSibling, name, namespace, mappedOldValue); + var queue = observer._recordQueue; + queue.push(record); + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (interestedObservers_1_1 && !interestedObservers_1_1.done && (_a = interestedObservers_1.return)) _a.call(interestedObservers_1); + } + finally { if (e_3) throw e_3.error; } + } + /** + * 5. Queue a mutation observer microtask. + */ + observer_queueAMutationObserverMicrotask(); +} +exports.observer_queueMutationRecord = observer_queueMutationRecord; +/** + * Queues a tree mutation record for target. + * + * @param target - target node + * @param addedNodes - a list od added nodes + * @param removedNodes - a list of removed nodes + * @param previousSibling - previous sibling of target before mutation + * @param nextSibling - next sibling of target before mutation + */ +function observer_queueTreeMutationRecord(target, addedNodes, removedNodes, previousSibling, nextSibling) { + /** + * To queue a tree mutation record for target with addedNodes, removedNodes, + * previousSibling, and nextSibling, queue a mutation record of "childList" + * for target with null, null, null, addedNodes, removedNodes, + * previousSibling, and nextSibling. + */ + observer_queueMutationRecord("childList", target, null, null, null, addedNodes, removedNodes, previousSibling, nextSibling); +} +exports.observer_queueTreeMutationRecord = observer_queueTreeMutationRecord; +/** + * Queues an attribute mutation record for target. + * + * @param target - target node + * @param name - name before mutation + * @param namespace - namespace before mutation + * @param oldValue - attribute value before mutation + */ +function observer_queueAttributeMutationRecord(target, name, namespace, oldValue) { + /** + * To queue an attribute mutation record for target with name, namespace, + * and oldValue, queue a mutation record of "attributes" for target with + * name, namespace, oldValue, « », « », null, and null. + */ + observer_queueMutationRecord("attributes", target, name, namespace, oldValue, [], [], null, null); +} +exports.observer_queueAttributeMutationRecord = observer_queueAttributeMutationRecord; +//# sourceMappingURL=MutationObserverAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/MutationObserverAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/MutationObserverAlgorithm.js.map new file mode 100644 index 0000000..4440b69 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/MutationObserverAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MutationObserverAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/MutationObserverAl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Q,EAAE,sBAAc;YAClC;;;;;;;;eAQG;YACH,IAAM,MAAM,GAAG,uCAAqB,CAAC,IAAI,EAAE,MAAM,EAC/C,uCAAqB,CAAC,MAAM,EAAE,UAAU,CAAC,EACzC,uCAAqB,CAAC,MAAM,EAAE,YAAY,CAAC,EAC3C,eAAe,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,CAAC,CAAA;YAEhE,IAAM,KAAK,GAAqB,QAAQ,CAAC,YAAY,CAAA;YACrD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;SACnB;;;;;;;;;IAED;;OAEG;IACH,wCAAwC,EAAE,CAAA;AAC5C,CAAC;AArFD,oEAqFC;AAED;;;;;;;;GAQG;AACH,SAAgB,gCAAgC,CAAC,MAAY,EAC3D,UAAkB,EAAE,YAAoB,EACxC,eAA4B,EAAE,WAAwB;IACtD;;;;;OAKG;IACH,4BAA4B,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAChE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,CAAC,CAAA;AAC3D,CAAC;AAXD,4EAWC;AAED;;;;;;;GAOG;AACH,SAAgB,qCAAqC,CAAC,MAAY,EAAE,IAAmB,EACrF,SAAwB,EAAE,QAAuB;IACjD;;;;OAIG;IACH,4BAA4B,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAChE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AACjC,CAAC;AATD,sFASC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/NamespaceAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/NamespaceAlgorithm.d.ts new file mode 100644 index 0000000..19a455b --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/NamespaceAlgorithm.d.ts @@ -0,0 +1,25 @@ +/** + * Validates the given qualified name. + * + * @param qualifiedName - qualified name + */ +export declare function namespace_validate(qualifiedName: string): void; +/** + * Validates and extracts a namespace, prefix and localName from the + * given namespace and qualified name. + * See: https://dom.spec.whatwg.org/#validate-and-extract. + * + * @param namespace - namespace + * @param qualifiedName - qualified name + * + * @returns a tuple with `namespace`, `prefix` and `localName`. + */ +export declare function namespace_validateAndExtract(namespace: string | null, qualifiedName: string): [string | null, string | null, string]; +/** + * Extracts a prefix and localName from the given qualified name. + * + * @param qualifiedName - qualified name + * + * @returns an tuple with `prefix` and `localName`. + */ +export declare function namespace_extractQName(qualifiedName: string): [string | null, string]; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/NamespaceAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/NamespaceAlgorithm.js new file mode 100644 index 0000000..793b923 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/NamespaceAlgorithm.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMException_1 = require("../dom/DOMException"); +var infra_1 = require("@oozcitak/infra"); +var XMLAlgorithm_1 = require("./XMLAlgorithm"); +/** + * Validates the given qualified name. + * + * @param qualifiedName - qualified name + */ +function namespace_validate(qualifiedName) { + /** + * To validate a qualifiedName, throw an "InvalidCharacterError" + * DOMException if qualifiedName does not match the Name or QName + * production. + */ + if (!XMLAlgorithm_1.xml_isName(qualifiedName)) + throw new DOMException_1.InvalidCharacterError("Invalid XML name: " + qualifiedName); + if (!XMLAlgorithm_1.xml_isQName(qualifiedName)) + throw new DOMException_1.InvalidCharacterError("Invalid XML qualified name: " + qualifiedName + "."); +} +exports.namespace_validate = namespace_validate; +/** + * Validates and extracts a namespace, prefix and localName from the + * given namespace and qualified name. + * See: https://dom.spec.whatwg.org/#validate-and-extract. + * + * @param namespace - namespace + * @param qualifiedName - qualified name + * + * @returns a tuple with `namespace`, `prefix` and `localName`. + */ +function namespace_validateAndExtract(namespace, qualifiedName) { + /** + * 1. If namespace is the empty string, set it to null. + * 2. Validate qualifiedName. + * 3. Let prefix be null. + * 4. Let localName be qualifiedName. + * 5. If qualifiedName contains a ":" (U+003E), then split the string on it + * and set prefix to the part before and localName to the part after. + * 6. If prefix is non-null and namespace is null, then throw a + * "NamespaceError" DOMException. + * 7. If prefix is "xml" and namespace is not the XML namespace, then throw + * a "NamespaceError" DOMException. + * 8. If either qualifiedName or prefix is "xmlns" and namespace is not the + * XMLNS namespace, then throw a "NamespaceError" DOMException. + * 9. If namespace is the XMLNS namespace and neither qualifiedName nor + * prefix is "xmlns", then throw a "NamespaceError" DOMException. + * 10. Return namespace, prefix, and localName. + */ + if (!namespace) + namespace = null; + namespace_validate(qualifiedName); + var parts = qualifiedName.split(':'); + var prefix = (parts.length === 2 ? parts[0] : null); + var localName = (parts.length === 2 ? parts[1] : qualifiedName); + if (prefix && namespace === null) + throw new DOMException_1.NamespaceError("Qualified name includes a prefix but the namespace is null."); + if (prefix === "xml" && namespace !== infra_1.namespace.XML) + throw new DOMException_1.NamespaceError("Qualified name includes the \"xml\" prefix but the namespace is not the XML namespace."); + if (namespace !== infra_1.namespace.XMLNS && + (prefix === "xmlns" || qualifiedName === "xmlns")) + throw new DOMException_1.NamespaceError("Qualified name includes the \"xmlns\" prefix but the namespace is not the XMLNS namespace."); + if (namespace === infra_1.namespace.XMLNS && + (prefix !== "xmlns" && qualifiedName !== "xmlns")) + throw new DOMException_1.NamespaceError("Qualified name does not include the \"xmlns\" prefix but the namespace is the XMLNS namespace."); + return [namespace, prefix, localName]; +} +exports.namespace_validateAndExtract = namespace_validateAndExtract; +/** + * Extracts a prefix and localName from the given qualified name. + * + * @param qualifiedName - qualified name + * + * @returns an tuple with `prefix` and `localName`. + */ +function namespace_extractQName(qualifiedName) { + namespace_validate(qualifiedName); + var parts = qualifiedName.split(':'); + var prefix = (parts.length === 2 ? parts[0] : null); + var localName = (parts.length === 2 ? parts[1] : qualifiedName); + return [prefix, localName]; +} +exports.namespace_extractQName = namespace_extractQName; +//# sourceMappingURL=NamespaceAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/NamespaceAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/NamespaceAlgorithm.js.map new file mode 100644 index 0000000..884898f --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/NamespaceAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NamespaceAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/NamespaceAlgorithm.ts"],"names":[],"mappings":";;AAAA,oDAA2E;AAC3E,yCAA6D;AAC7D,+CAAwD;AAExD;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,aAAqB;IACtD;;;;OAIG;IACH,IAAI,CAAC,yBAAU,CAAC,aAAa,CAAC;QAC5B,MAAM,IAAI,oCAAqB,CAAC,uBAAqB,aAAe,CAAC,CAAA;IAEvE,IAAI,CAAC,0BAAW,CAAC,aAAa,CAAC;QAC7B,MAAM,IAAI,oCAAqB,CAAC,iCAA+B,aAAa,MAAG,CAAC,CAAA;AACpF,CAAC;AAXD,gDAWC;AAED;;;;;;;;;GASG;AACH,SAAgB,4BAA4B,CAAC,SAAwB,EAAE,aAAqB;IAG1F;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,CAAC,SAAS;QAAE,SAAS,GAAG,IAAI,CAAA;IAEhC,kBAAkB,CAAC,aAAa,CAAC,CAAA;IAEjC,IAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACtC,IAAM,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACrD,IAAM,SAAS,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAA;IAEjE,IAAI,MAAM,IAAI,SAAS,KAAK,IAAI;QAC9B,MAAM,IAAI,6BAAc,CAAC,6DAA6D,CAAC,CAAA;IAEzF,IAAI,MAAM,KAAK,KAAK,IAAI,SAAS,KAAK,iBAAc,CAAC,GAAG;QACtD,MAAM,IAAI,6BAAc,CAAC,wFAAsF,CAAC,CAAA;IAElH,IAAI,SAAS,KAAK,iBAAc,CAAC,KAAK;QACpC,CAAC,MAAM,KAAK,OAAO,IAAI,aAAa,KAAK,OAAO,CAAC;QACjD,MAAM,IAAI,6BAAc,CAAC,4FAA0F,CAAC,CAAA;IAEtH,IAAI,SAAS,KAAK,iBAAc,CAAC,KAAK;QACpC,CAAC,MAAM,KAAK,OAAO,IAAI,aAAa,KAAK,OAAO,CAAC;QACjD,MAAM,IAAI,6BAAc,CAAC,gGAA8F,CAAC,CAAA;IAE1H,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,CAAA;AACvC,CAAC;AA3CD,oEA2CC;AAED;;;;;;GAMG;AACH,SAAgB,sBAAsB,CAAC,aAAqB;IAE1D,kBAAkB,CAAC,aAAa,CAAC,CAAA;IAEjC,IAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACtC,IAAM,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACrD,IAAM,SAAS,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAA;IAEjE,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAC5B,CAAC;AATD,wDASC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/NodeAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/NodeAlgorithm.d.ts new file mode 100644 index 0000000..dde3bb9 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/NodeAlgorithm.d.ts @@ -0,0 +1,68 @@ +import { Element, Node, Document, HTMLCollection } from "../dom/interfaces"; +/** + * Replaces the contents of the given node with a single text node. + * + * @param string - node contents + * @param parent - a node + */ +export declare function node_stringReplaceAll(str: string, parent: Node): void; +/** + * Clones a node. + * + * @param node - a node to clone + * @param document - the document to own the cloned node + * @param cloneChildrenFlag - whether to clone node's children + */ +export declare function node_clone(node: Node, document?: Document | null, cloneChildrenFlag?: boolean): Node; +/** + * Determines if two nodes can be considered equal. + * + * @param a - node to compare + * @param b - node to compare + */ +export declare function node_equals(a: Node, b: Node): boolean; +/** + * Returns a collection of elements with the given qualified name which are + * descendants of the given root node. + * See: https://dom.spec.whatwg.org/#concept-getelementsbytagname + * + * @param qualifiedName - qualified name + * @param root - root node + */ +export declare function node_listOfElementsWithQualifiedName(qualifiedName: string, root: Node): HTMLCollection; +/** + * Returns a collection of elements with the given namespace which are + * descendants of the given root node. + * See: https://dom.spec.whatwg.org/#concept-getelementsbytagnamens + * + * @param namespace - element namespace + * @param localName - local name + * @param root - root node + */ +export declare function node_listOfElementsWithNamespace(namespace: string | null, localName: string, root: Node): HTMLCollection; +/** + * Returns a collection of elements with the given class names which are + * descendants of the given root node. + * See: https://dom.spec.whatwg.org/#concept-getelementsbyclassname + * + * @param namespace - element namespace + * @param localName - local name + * @param root - root node + */ +export declare function node_listOfElementsWithClassNames(classNames: string, root: Node): HTMLCollection; +/** + * Searches for a namespace prefix associated with the given namespace + * starting from the given element through its ancestors. + * + * @param element - an element node to start searching at + * @param namespace - namespace to search for + */ +export declare function node_locateANamespacePrefix(element: Element, namespace: string | null): string | null; +/** + * Searches for a namespace associated with the given namespace prefix + * starting from the given node through its ancestors. + * + * @param node - a node to start searching at + * @param prefix - namespace prefix to search for + */ +export declare function node_locateANamespace(node: Node, prefix: string | null): string | null; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/NodeAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/NodeAlgorithm.js new file mode 100644 index 0000000..ddcb0c3 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/NodeAlgorithm.js @@ -0,0 +1,543 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("../dom/DOMImpl"); +var util_1 = require("../util"); +var infra_1 = require("@oozcitak/infra"); +var CreateAlgorithm_1 = require("./CreateAlgorithm"); +var OrderedSetAlgorithm_1 = require("./OrderedSetAlgorithm"); +var DOMAlgorithm_1 = require("./DOMAlgorithm"); +var MutationAlgorithm_1 = require("./MutationAlgorithm"); +var ElementAlgorithm_1 = require("./ElementAlgorithm"); +/** + * Replaces the contents of the given node with a single text node. + * + * @param string - node contents + * @param parent - a node + */ +function node_stringReplaceAll(str, parent) { + /** + * 1. Let node be null. + * 2. If string is not the empty string, then set node to a new Text node + * whose data is string and node document is parent’s node document. + * 3. Replace all with node within parent. + */ + var node = null; + if (str !== '') { + node = CreateAlgorithm_1.create_text(parent._nodeDocument, str); + } + MutationAlgorithm_1.mutation_replaceAll(node, parent); +} +exports.node_stringReplaceAll = node_stringReplaceAll; +/** + * Clones a node. + * + * @param node - a node to clone + * @param document - the document to own the cloned node + * @param cloneChildrenFlag - whether to clone node's children + */ +function node_clone(node, document, cloneChildrenFlag) { + var e_1, _a, e_2, _b; + if (document === void 0) { document = null; } + if (cloneChildrenFlag === void 0) { cloneChildrenFlag = false; } + /** + * 1. If document is not given, let document be node’s node document. + */ + if (document === null) + document = node._nodeDocument; + var copy; + if (util_1.Guard.isElementNode(node)) { + /** + * 2. If node is an element, then: + * 2.1. Let copy be the result of creating an element, given document, + * node’s local name, node’s namespace, node’s namespace prefix, + * and node’s is value, with the synchronous custom elements flag unset. + * 2.2. For each attribute in node’s attribute list: + * 2.2.1. Let copyAttribute be a clone of attribute. + * 2.2.2. Append copyAttribute to copy. + */ + copy = ElementAlgorithm_1.element_createAnElement(document, node._localName, node._namespace, node._namespacePrefix, node._is, false); + try { + for (var _c = __values(node._attributeList), _d = _c.next(); !_d.done; _d = _c.next()) { + var attribute = _d.value; + var copyAttribute = node_clone(attribute, document); + ElementAlgorithm_1.element_append(copyAttribute, copy); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_d && !_d.done && (_a = _c.return)) _a.call(_c); + } + finally { if (e_1) throw e_1.error; } + } + } + else { + /** + * 3. Otherwise, let copy be a node that implements the same interfaces as + * node, and fulfills these additional requirements, switching on node: + * - Document + * Set copy’s encoding, content type, URL, origin, type, and mode, to those + * of node. + * - DocumentType + * Set copy’s name, public ID, and system ID, to those of node. + * - Attr + * Set copy’s namespace, namespace prefix, local name, and value, to + * those of node. + * - Text + * - Comment + * Set copy’s data, to that of node. + * - ProcessingInstruction + * Set copy’s target and data to those of node. + * - Any other node + */ + if (util_1.Guard.isDocumentNode(node)) { + var doc = CreateAlgorithm_1.create_document(); + doc._encoding = node._encoding; + doc._contentType = node._contentType; + doc._URL = node._URL; + doc._origin = node._origin; + doc._type = node._type; + doc._mode = node._mode; + copy = doc; + } + else if (util_1.Guard.isDocumentTypeNode(node)) { + var doctype = CreateAlgorithm_1.create_documentType(document, node._name, node._publicId, node._systemId); + copy = doctype; + } + else if (util_1.Guard.isAttrNode(node)) { + var attr = CreateAlgorithm_1.create_attr(document, node.localName); + attr._namespace = node._namespace; + attr._namespacePrefix = node._namespacePrefix; + attr._value = node._value; + copy = attr; + } + else if (util_1.Guard.isExclusiveTextNode(node)) { + copy = CreateAlgorithm_1.create_text(document, node._data); + } + else if (util_1.Guard.isCDATASectionNode(node)) { + copy = CreateAlgorithm_1.create_cdataSection(document, node._data); + } + else if (util_1.Guard.isCommentNode(node)) { + copy = CreateAlgorithm_1.create_comment(document, node._data); + } + else if (util_1.Guard.isProcessingInstructionNode(node)) { + copy = CreateAlgorithm_1.create_processingInstruction(document, node._target, node._data); + } + else if (util_1.Guard.isDocumentFragmentNode(node)) { + copy = CreateAlgorithm_1.create_documentFragment(document); + } + else { + copy = Object.create(node); + } + } + /** + * 4. Set copy’s node document and document to copy, if copy is a document, + * and set copy’s node document to document otherwise. + */ + if (util_1.Guard.isDocumentNode(copy)) { + copy._nodeDocument = copy; + document = copy; + } + else { + copy._nodeDocument = document; + } + /** + * 5. Run any cloning steps defined for node in other applicable + * specifications and pass copy, node, document and the clone children flag + * if set, as parameters. + */ + if (DOMImpl_1.dom.features.steps) { + DOMAlgorithm_1.dom_runCloningSteps(copy, node, document, cloneChildrenFlag); + } + /** + * 6. If the clone children flag is set, clone all the children of node and + * append them to copy, with document as specified and the clone children + * flag being set. + */ + if (cloneChildrenFlag) { + try { + for (var _e = __values(node._children), _f = _e.next(); !_f.done; _f = _e.next()) { + var child = _f.value; + var childCopy = node_clone(child, document, true); + MutationAlgorithm_1.mutation_append(childCopy, copy); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_f && !_f.done && (_b = _e.return)) _b.call(_e); + } + finally { if (e_2) throw e_2.error; } + } + } + /** + * 7. Return copy. + */ + return copy; +} +exports.node_clone = node_clone; +/** + * Determines if two nodes can be considered equal. + * + * @param a - node to compare + * @param b - node to compare + */ +function node_equals(a, b) { + var e_3, _a, e_4, _b; + /** + * 1. A and B’s nodeType attribute value is identical. + */ + if (a._nodeType !== b._nodeType) + return false; + /** + * 2. The following are also equal, depending on A: + * - DocumentType + * Its name, public ID, and system ID. + * - Element + * Its namespace, namespace prefix, local name, and its attribute list’s size. + * - Attr + * Its namespace, local name, and value. + * - ProcessingInstruction + * Its target and data. + * - Text + * - Comment + * Its data. + */ + if (util_1.Guard.isDocumentTypeNode(a) && util_1.Guard.isDocumentTypeNode(b)) { + if (a._name !== b._name || a._publicId !== b._publicId || + a._systemId !== b._systemId) + return false; + } + else if (util_1.Guard.isElementNode(a) && util_1.Guard.isElementNode(b)) { + if (a._namespace !== b._namespace || a._namespacePrefix !== b._namespacePrefix || + a._localName !== b._localName || + a._attributeList.length !== b._attributeList.length) + return false; + } + else if (util_1.Guard.isAttrNode(a) && util_1.Guard.isAttrNode(b)) { + if (a._namespace !== b._namespace || a._localName !== b._localName || + a._value !== b._value) + return false; + } + else if (util_1.Guard.isProcessingInstructionNode(a) && util_1.Guard.isProcessingInstructionNode(b)) { + if (a._target !== b._target || a._data !== b._data) + return false; + } + else if (util_1.Guard.isCharacterDataNode(a) && util_1.Guard.isCharacterDataNode(b)) { + if (a._data !== b._data) + return false; + } + /** + * 3. If A is an element, each attribute in its attribute list has an attribute + * that equals an attribute in B’s attribute list. + */ + if (util_1.Guard.isElementNode(a) && util_1.Guard.isElementNode(b)) { + var attrMap = {}; + try { + for (var _c = __values(a._attributeList), _d = _c.next(); !_d.done; _d = _c.next()) { + var attrA = _d.value; + attrMap[attrA._localName] = attrA; + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (_d && !_d.done && (_a = _c.return)) _a.call(_c); + } + finally { if (e_3) throw e_3.error; } + } + try { + for (var _e = __values(b._attributeList), _f = _e.next(); !_f.done; _f = _e.next()) { + var attrB = _f.value; + var attrA = attrMap[attrB._localName]; + if (!attrA) + return false; + if (!node_equals(attrA, attrB)) + return false; + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (_f && !_f.done && (_b = _e.return)) _b.call(_e); + } + finally { if (e_4) throw e_4.error; } + } + } + /** + * 4. A and B have the same number of children. + * 5. Each child of A equals the child of B at the identical index. + */ + if (a._children.size !== b._children.size) + return false; + var itA = a._children[Symbol.iterator](); + var itB = b._children[Symbol.iterator](); + var resultA = itA.next(); + var resultB = itB.next(); + while (!resultA.done && !resultB.done) { + var child1 = resultA.value; + var child2 = resultB.value; + if (!node_equals(child1, child2)) + return false; + resultA = itA.next(); + resultB = itB.next(); + } + return true; +} +exports.node_equals = node_equals; +/** + * Returns a collection of elements with the given qualified name which are + * descendants of the given root node. + * See: https://dom.spec.whatwg.org/#concept-getelementsbytagname + * + * @param qualifiedName - qualified name + * @param root - root node + */ +function node_listOfElementsWithQualifiedName(qualifiedName, root) { + /** + * 1. If qualifiedName is "*" (U+002A), return a HTMLCollection rooted at + * root, whose filter matches only descendant elements. + * 2. Otherwise, if root’s node document is an HTML document, return a + * HTMLCollection rooted at root, whose filter matches the following + * descendant elements: + * 2.1. Whose namespace is the HTML namespace and whose qualified name is + * qualifiedName, in ASCII lowercase. + * 2.2. Whose namespace is not the HTML namespace and whose qualified name + * is qualifiedName. + * 3. Otherwise, return a HTMLCollection rooted at root, whose filter + * matches descendant elements whose qualified name is qualifiedName. + */ + if (qualifiedName === "*") { + return CreateAlgorithm_1.create_htmlCollection(root); + } + else if (root._nodeDocument._type === "html") { + return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + if (ele._namespace === infra_1.namespace.HTML && + ele._qualifiedName === qualifiedName.toLowerCase()) { + return true; + } + else if (ele._namespace !== infra_1.namespace.HTML && + ele._qualifiedName === qualifiedName) { + return true; + } + else { + return false; + } + }); + } + else { + return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + return (ele._qualifiedName === qualifiedName); + }); + } +} +exports.node_listOfElementsWithQualifiedName = node_listOfElementsWithQualifiedName; +/** + * Returns a collection of elements with the given namespace which are + * descendants of the given root node. + * See: https://dom.spec.whatwg.org/#concept-getelementsbytagnamens + * + * @param namespace - element namespace + * @param localName - local name + * @param root - root node + */ +function node_listOfElementsWithNamespace(namespace, localName, root) { + /** + * 1. If namespace is the empty string, set it to null. + * 2. If both namespace and localName are "*" (U+002A), return a + * HTMLCollection rooted at root, whose filter matches descendant elements. + * 3. Otherwise, if namespace is "*" (U+002A), return a HTMLCollection + * rooted at root, whose filter matches descendant elements whose local + * name is localName. + * 4. Otherwise, if localName is "*" (U+002A), return a HTMLCollection + * rooted at root, whose filter matches descendant elements whose + * namespace is namespace. + * 5. Otherwise, return a HTMLCollection rooted at root, whose filter + * matches descendant elements whose namespace is namespace and local + * name is localName. + */ + if (namespace === '') + namespace = null; + if (namespace === "*" && localName === "*") { + return CreateAlgorithm_1.create_htmlCollection(root); + } + else if (namespace === "*") { + return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + return (ele._localName === localName); + }); + } + else if (localName === "*") { + return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + return (ele._namespace === namespace); + }); + } + else { + return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + return (ele._localName === localName && ele._namespace === namespace); + }); + } +} +exports.node_listOfElementsWithNamespace = node_listOfElementsWithNamespace; +/** + * Returns a collection of elements with the given class names which are + * descendants of the given root node. + * See: https://dom.spec.whatwg.org/#concept-getelementsbyclassname + * + * @param namespace - element namespace + * @param localName - local name + * @param root - root node + */ +function node_listOfElementsWithClassNames(classNames, root) { + /** + * 1. Let classes be the result of running the ordered set parser + * on classNames. + * 2. If classes is the empty set, return an empty HTMLCollection. + * 3. Return a HTMLCollection rooted at root, whose filter matches + * descendant elements that have all their classes in classes. + * The comparisons for the classes must be done in an ASCII case-insensitive + * manner if root’s node document’s mode is "quirks", and in a + * case-sensitive manner otherwise. + */ + var classes = OrderedSetAlgorithm_1.orderedSet_parse(classNames); + if (classes.size === 0) { + return CreateAlgorithm_1.create_htmlCollection(root, function () { return false; }); + } + var caseSensitive = (root._nodeDocument._mode !== "quirks"); + return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + var eleClasses = ele.classList; + return OrderedSetAlgorithm_1.orderedSet_contains(eleClasses._tokenSet, classes, caseSensitive); + }); +} +exports.node_listOfElementsWithClassNames = node_listOfElementsWithClassNames; +/** + * Searches for a namespace prefix associated with the given namespace + * starting from the given element through its ancestors. + * + * @param element - an element node to start searching at + * @param namespace - namespace to search for + */ +function node_locateANamespacePrefix(element, namespace) { + /** + * 1. If element’s namespace is namespace and its namespace prefix is not + * null, then return its namespace prefix. + */ + if (element._namespace === namespace && element._namespacePrefix !== null) { + return element._namespacePrefix; + } + /** + * 2. If element has an attribute whose namespace prefix is "xmlns" and + * value is namespace, then return element’s first such attribute’s + * local name. + */ + for (var i = 0; i < element._attributeList.length; i++) { + var attr = element._attributeList[i]; + if (attr._namespacePrefix === "xmlns" && attr._value === namespace) { + return attr._localName; + } + } + /** + * 3. If element’s parent element is not null, then return the result of + * running locate a namespace prefix on that element using namespace. + */ + if (element._parent && util_1.Guard.isElementNode(element._parent)) { + return node_locateANamespacePrefix(element._parent, namespace); + } + /** + * 4. Return null. + */ + return null; +} +exports.node_locateANamespacePrefix = node_locateANamespacePrefix; +/** + * Searches for a namespace associated with the given namespace prefix + * starting from the given node through its ancestors. + * + * @param node - a node to start searching at + * @param prefix - namespace prefix to search for + */ +function node_locateANamespace(node, prefix) { + if (util_1.Guard.isElementNode(node)) { + /** + * 1. If its namespace is not null and its namespace prefix is prefix, + * then return namespace. + */ + if (node._namespace !== null && node._namespacePrefix === prefix) { + return node._namespace; + } + /** + * 2. If it has an attribute whose namespace is the XMLNS namespace, + * namespace prefix is "xmlns", and local name is prefix, or if prefix + * is null and it has an attribute whose namespace is the XMLNS namespace, + * namespace prefix is null, and local name is "xmlns", then return its + * value if it is not the empty string, and null otherwise. + */ + for (var i = 0; i < node._attributeList.length; i++) { + var attr = node._attributeList[i]; + if (attr._namespace === infra_1.namespace.XMLNS && + attr._namespacePrefix === "xmlns" && + attr._localName === prefix) { + return attr._value || null; + } + if (prefix === null && attr._namespace === infra_1.namespace.XMLNS && + attr._namespacePrefix === null && attr._localName === "xmlns") { + return attr._value || null; + } + } + /** + * 3. If its parent element is null, then return null. + */ + if (node.parentElement === null) + return null; + /** + * 4. Return the result of running locate a namespace on its parent + * element using prefix. + */ + return node_locateANamespace(node.parentElement, prefix); + } + else if (util_1.Guard.isDocumentNode(node)) { + /** + * 1. If its document element is null, then return null. + * 2. Return the result of running locate a namespace on its document + * element using prefix. + */ + if (node.documentElement === null) + return null; + return node_locateANamespace(node.documentElement, prefix); + } + else if (util_1.Guard.isDocumentTypeNode(node) || util_1.Guard.isDocumentFragmentNode(node)) { + return null; + } + else if (util_1.Guard.isAttrNode(node)) { + /** + * 1. If its element is null, then return null. + * 2. Return the result of running locate a namespace on its element + * using prefix. + */ + if (node._element === null) + return null; + return node_locateANamespace(node._element, prefix); + } + else { + /** + * 1. If its parent element is null, then return null. + * 2. Return the result of running locate a namespace on its parent + * element using prefix. + */ + if (!node._parent || !util_1.Guard.isElementNode(node._parent)) + return null; + return node_locateANamespace(node._parent, prefix); + } +} +exports.node_locateANamespace = node_locateANamespace; +//# sourceMappingURL=NodeAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/NodeAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/NodeAlgorithm.js.map new file mode 100644 index 0000000..0ed2811 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/NodeAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NodeAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/NodeAlgorithm.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,0CAAoC;AAIpC,gCAA+B;AAC/B,yCAA6D;AAC7D,qDAI0B;AAC1B,6DAA6E;AAC7E,+CAAoD;AACpD,yDAA0E;AAC1E,uDAA4E;AAE5E;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,GAAW,EAAE,MAAY;IAC7D;;;;;OAKG;IACH,IAAI,IAAI,GAAgB,IAAI,CAAA;IAC5B,IAAI,GAAG,KAAK,EAAE,EAAE;QACd,IAAI,GAAG,6BAAW,CAAC,MAAM,CAAC,aAAa,EAAE,GAAG,CAAC,CAAA;KAC9C;IACD,uCAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;AACnC,CAAC;AAZD,sDAYC;AAED;;;;;;GAMG;AACH,SAAgB,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/@oozcitak/dom/lib/algorithm/NodeIteratorAlgorithm.d.ts new file mode 100644 index 0000000..296601d --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/NodeIteratorAlgorithm.d.ts @@ -0,0 +1,15 @@ +import { Node, NodeIterator } from "../dom/interfaces"; +import { FixedSizeSet } from "@oozcitak/util"; +/** + * Returns the next or previous node in the subtree, or `null` if + * there are none. + * + * @param iterator - the `NodeIterator` instance + * @param forward- `true` to return the next node, or `false` to + * return the previous node. + */ +export declare function nodeIterator_traverse(iterator: NodeIterator, forward: boolean): Node | null; +/** + * Gets the global iterator list. + */ +export declare function nodeIterator_iteratorList(): FixedSizeSet; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/NodeIteratorAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/NodeIteratorAlgorithm.js new file mode 100644 index 0000000..0fb6248 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/NodeIteratorAlgorithm.js @@ -0,0 +1,105 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("../dom/DOMImpl"); +var interfaces_1 = require("../dom/interfaces"); +var TraversalAlgorithm_1 = require("./TraversalAlgorithm"); +var TreeAlgorithm_1 = require("./TreeAlgorithm"); +/** + * Returns the next or previous node in the subtree, or `null` if + * there are none. + * + * @param iterator - the `NodeIterator` instance + * @param forward- `true` to return the next node, or `false` to + * return the previous node. + */ +function nodeIterator_traverse(iterator, forward) { + /** + * 1. Let node be iterator’s reference. + * 2. Let beforeNode be iterator’s pointer before reference. + */ + var node = iterator._reference; + var beforeNode = iterator._pointerBeforeReference; + /** + * 3. While true: + */ + while (true) { + /** + * 3.1. Branch on direction: + */ + if (forward) { + /** + * - next + */ + if (!beforeNode) { + /** + * If beforeNode is false, then set node to the first node following + * node in iterator’s iterator collection. If there is no such node, + * then return null. + */ + var nextNode = TreeAlgorithm_1.tree_getFollowingNode(iterator._root, node); + if (nextNode) { + node = nextNode; + } + else { + return null; + } + } + else { + /** + * If beforeNode is true, then set it to false. + */ + beforeNode = false; + } + } + else { + /** + * - previous + */ + if (beforeNode) { + /** + * If beforeNode is true, then set node to the first node preceding + * node in iterator’s iterator collection. If there is no such node, + * then return null. + */ + var prevNode = TreeAlgorithm_1.tree_getPrecedingNode(iterator.root, node); + if (prevNode) { + node = prevNode; + } + else { + return null; + } + } + else { + /** + * If beforeNode is false, then set it to true. + */ + beforeNode = true; + } + } + /** + * 3.2. Let result be the result of filtering node within iterator. + * 3.3. If result is FILTER_ACCEPT, then break. + */ + var result = TraversalAlgorithm_1.traversal_filter(iterator, node); + if (result === interfaces_1.FilterResult.Accept) { + break; + } + } + /** + * 4. Set iterator’s reference to node. + * 5. Set iterator’s pointer before reference to beforeNode. + * 6. Return node. + */ + iterator._reference = node; + iterator._pointerBeforeReference = beforeNode; + return node; +} +exports.nodeIterator_traverse = nodeIterator_traverse; +/** + * Gets the global iterator list. + */ +function nodeIterator_iteratorList() { + return DOMImpl_1.dom.window._iteratorList; +} +exports.nodeIterator_iteratorList = nodeIterator_iteratorList; +//# sourceMappingURL=NodeIteratorAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/NodeIteratorAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/NodeIteratorAlgorithm.js.map new file mode 100644 index 0000000..47a85d6 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/NodeIteratorAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NodeIteratorAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/NodeIteratorAlgorithm.ts"],"names":[],"mappings":";;AAAA,0CAAoC;AACpC,gDAAoE;AAEpE,2DAAuD;AACvD,iDAA8E;AAE9E;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CAAC,QAAsB,EAAE,OAAgB;IAC5E;;;OAGG;IACH,IAAI,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAA;IAC9B,IAAI,UAAU,GAAG,QAAQ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ithm/OrderedSetAlgorithm.d.ts new file mode 100644 index 0000000..491d776 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/OrderedSetAlgorithm.d.ts @@ -0,0 +1,27 @@ +/** + * Converts a whitespace separated string into an array of tokens. + * + * @param value - a string of whitespace separated tokens + */ +export declare function orderedSet_parse(value: string): Set; +/** + * Converts an array of tokens into a space separated string. + * + * @param tokens - an array of token strings + */ +export declare function orderedSet_serialize(tokens: Set): string; +/** + * Removes duplicate tokens and convert all whitespace characters + * to space. + * + * @param value - a string of whitespace separated tokens + */ +export declare function orderedSet_sanitize(value: string): string; +/** + * Determines whether a set contains the other. + * + * @param set1 - a set + * @param set1 - a set that is contained in set1 + * @param caseSensitive - whether matches are case-sensitive + */ +export declare function orderedSet_contains(set1: Set, set2: Set, caseSensitive: boolean): boolean; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/OrderedSetAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/OrderedSetAlgorithm.js new file mode 100644 index 0000000..f606e35 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/OrderedSetAlgorithm.js @@ -0,0 +1,125 @@ +"use strict"; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var infra_1 = require("@oozcitak/infra"); +/** + * Converts a whitespace separated string into an array of tokens. + * + * @param value - a string of whitespace separated tokens + */ +function orderedSet_parse(value) { + /** + * 1. Let inputTokens be the result of splitting input on ASCII whitespace. + * 2. Let tokens be a new ordered set. + * 3. For each token in inputTokens, append token to tokens. + * 4. Return tokens. + */ + var inputTokens = infra_1.string.splitAStringOnASCIIWhitespace(value); + return new Set(inputTokens); +} +exports.orderedSet_parse = orderedSet_parse; +/** + * Converts an array of tokens into a space separated string. + * + * @param tokens - an array of token strings + */ +function orderedSet_serialize(tokens) { + /** + * The ordered set serializer takes a set and returns the concatenation of + * set using U+0020 SPACE. + */ + return __spread(tokens).join(' '); +} +exports.orderedSet_serialize = orderedSet_serialize; +/** + * Removes duplicate tokens and convert all whitespace characters + * to space. + * + * @param value - a string of whitespace separated tokens + */ +function orderedSet_sanitize(value) { + return orderedSet_serialize(orderedSet_parse(value)); +} +exports.orderedSet_sanitize = orderedSet_sanitize; +/** + * Determines whether a set contains the other. + * + * @param set1 - a set + * @param set1 - a set that is contained in set1 + * @param caseSensitive - whether matches are case-sensitive + */ +function orderedSet_contains(set1, set2, caseSensitive) { + var e_1, _a, e_2, _b; + try { + for (var set2_1 = __values(set2), set2_1_1 = set2_1.next(); !set2_1_1.done; set2_1_1 = set2_1.next()) { + var val2 = set2_1_1.value; + var found = false; + try { + for (var set1_1 = (e_2 = void 0, __values(set1)), set1_1_1 = set1_1.next(); !set1_1_1.done; set1_1_1 = set1_1.next()) { + var val1 = set1_1_1.value; + if (caseSensitive) { + if (val1 === val2) { + found = true; + break; + } + } + else { + if (val1.toUpperCase() === val2.toUpperCase()) { + found = true; + break; + } + } + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (set1_1_1 && !set1_1_1.done && (_b = set1_1.return)) _b.call(set1_1); + } + finally { if (e_2) throw e_2.error; } + } + if (!found) + return false; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (set2_1_1 && !set2_1_1.done && (_a = set2_1.return)) _a.call(set2_1); + } + finally { if (e_1) throw e_1.error; } + } + return true; +} +exports.orderedSet_contains = orderedSet_contains; +//# sourceMappingURL=OrderedSetAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/OrderedSetAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/OrderedSetAlgorithm.js.map new file mode 100644 index 0000000..6d3a739 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/OrderedSetAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"OrderedSetAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/OrderedSetAlgorithm.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAuD;AAEvD;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,KAAa;IAC5C;;;;;OAKG;IACH,IAAM,WAAW,GAAG,cAAW,CAAC,6BAA6B,CAAC,KAAK,CAAC,CAAA;IACpE,OAAO,IAAI,GAAG,CAAS,WAAW,CAAC,CAAA;AACrC,CAAC;AATD,4CASC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,MAAmB;IACtD;;;OAGG;IACH,OAAO,SAAI,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;AAC9B,CAAC;AAND,oDAMC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,KAAa;IAC/C,OAAO,oBAAoB,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAA;AACtD,CAAC;AAFD,kDAEC;AAED;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAC,IAAiB,EAAE,IAAiB,EACtE,aAAsB;;;QAEtB,KAAmB,IAAA,SAAA,SAAA,IAAI,CAAA,0BAAA,4CAAE;YAApB,IAAM,IAAI,iBAAA;YACb,IAAI,KAAK,GAAG,KAAK,CAAA;;gBACjB,KAAmB,IAAA,wBAAA,SAAA,IAAI,CAAA,CAAA,0BAAA,4CAAE;oBAApB,IAAM,IAAI,iBAAA;oBACb,IAAI,aAAa,EAAE;wBACjB,IAAI,IAAI,KAAK,IAAI,EAAE;4BACjB,KAAK,GAAG,IAAI,CAAA;4BACZ,MAAK;yBACN;qBACF;yBAAM;wBACL,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,EAAE;4BAC7C,KAAK,GAAG,IAAI,CAAA;4BACZ,MAAK;yBACN;qBACF;iBACF;;;;;;;;;YACD,IAAI,CAAC,KAAK;gBAAE,OAAO,KAAK,CAAA;SACzB;;;;;;;;;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAtBD,kDAsBC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/ParentNodeAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/ParentNodeAlgorithm.d.ts new file mode 100644 index 0000000..5f78c30 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/ParentNodeAlgorithm.d.ts @@ -0,0 +1,9 @@ +import { Node, Document } from "../dom/interfaces"; +/** + * Converts the given nodes or strings into a node (if `nodes` has + * only one element) or a document fragment. + * + * @param nodes - the array of nodes or strings, + * @param document - owner document + */ +export declare function parentNode_convertNodesIntoANode(nodes: (Node | string)[], document: Document): Node; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/ParentNodeAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/ParentNodeAlgorithm.js new file mode 100644 index 0000000..d77b976 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/ParentNodeAlgorithm.js @@ -0,0 +1,69 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var util_1 = require("@oozcitak/util"); +var CreateAlgorithm_1 = require("./CreateAlgorithm"); +/** + * Converts the given nodes or strings into a node (if `nodes` has + * only one element) or a document fragment. + * + * @param nodes - the array of nodes or strings, + * @param document - owner document + */ +function parentNode_convertNodesIntoANode(nodes, document) { + var e_1, _a; + /** + * 1. Let node be null. + * 2. Replace each string in nodes with a new Text node whose data is the + * string and node document is document. + */ + var node = null; + for (var i = 0; i < nodes.length; i++) { + var item = nodes[i]; + if (util_1.isString(item)) { + var text = CreateAlgorithm_1.create_text(document, item); + nodes[i] = text; + } + } + /** + * 3. If nodes contains one node, set node to that node. + * 4. Otherwise, set node to a new DocumentFragment whose node document is + * document, and then append each node in nodes, if any, to it. + */ + if (nodes.length === 1) { + node = nodes[0]; + } + else { + node = CreateAlgorithm_1.create_documentFragment(document); + var ns = node; + try { + for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) { + var item = nodes_1_1.value; + ns.appendChild(item); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1); + } + finally { if (e_1) throw e_1.error; } + } + } + /** + * 5. Return node. + */ + return node; +} +exports.parentNode_convertNodesIntoANode = parentNode_convertNodesIntoANode; +//# sourceMappingURL=ParentNodeAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/ParentNodeAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/ParentNodeAlgorithm.js.map new file mode 100644 index 0000000..fee1278 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/ParentNodeAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ParentNodeAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/ParentNodeAlgorithm.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,uCAAyC;AACzC,qDAAwE;AAExE;;;;;;GAMG;AACH,SAAgB,gCAAgC,CAAC,KAAwB,EACvE,QAAkB;;IAElB;;;;OAIG;IACH,IAAI,IAAI,GAAgB,IAAI,CAAA;IAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,IAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QACrB,IAAI,eAAQ,CAAC,IAAI,CAAC,EAAE;YAClB,IAAM,IAAI,GAAG,6BAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;YACxC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;SAChB;KACF;IAED;;;;OAIG;IACH,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACtB,IAAI,GAAG,KAAK,CAAC,CAAC,CAAS,CAAA;KACxB;SAAM;QACL,IAAI,GAAG,yCAAuB,CAAC,QAAQ,CAAC,CAAA;QACxC,IAAM,EAAE,GAAG,IAAI,CAAA;;YACf,KAAmB,IAAA,UAAA,SAAA,KAAK,CAAA,4BAAA,+CAAE;gBAArB,IAAM,IAAI,kBAAA;gBACb,EAAE,CAAC,WAAW,CAAC,IAAY,CAAC,CAAA;aAC7B;;;;;;;;;KACF;IAED;;OAEG;IACH,OAAO,IAAI,CAAA;AACb,CAAC;AApCD,4EAoCC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/RangeAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/RangeAlgorithm.d.ts new file mode 100644 index 0000000..dc1358b --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/RangeAlgorithm.d.ts @@ -0,0 +1,82 @@ +import { Node, AbstractRange, DocumentFragment, Range } from "../dom/interfaces"; +/** + * Determines if the node's start boundary point is at its end boundary + * point. + * + * @param range - a range + */ +export declare function range_collapsed(range: AbstractRange): boolean; +/** + * Gets the root node of a range. + * + * @param range - a range + */ +export declare function range_root(range: AbstractRange): Node; +/** + * Determines if a node is fully contained in a range. + * + * @param node - a node + * @param range - a range + */ +export declare function range_isContained(node: Node, range: AbstractRange): boolean; +/** + * Determines if a node is partially contained in a range. + * + * @param node - a node + * @param range - a range + */ +export declare function range_isPartiallyContained(node: Node, range: AbstractRange): boolean; +/** + * Sets the start boundary point of a range. + * + * @param range - a range + * @param node - a node + * @param offset - an offset into node + */ +export declare function range_setTheStart(range: AbstractRange, node: Node, offset: number): void; +/** + * Sets the end boundary point of a range. + * + * @param range - a range + * @param node - a node + * @param offset - an offset into node + */ +export declare function range_setTheEnd(range: AbstractRange, node: Node, offset: number): void; +/** + * Selects a node. + * + * @param range - a range + * @param node - a node + */ +export declare function range_select(node: Node, range: AbstractRange): void; +/** + * EXtracts the contents of range as a document fragment. + * + * @param range - a range + */ +export declare function range_extract(range: AbstractRange): DocumentFragment; +/** + * Clones the contents of range as a document fragment. + * + * @param range - a range + */ +export declare function range_cloneTheContents(range: AbstractRange): DocumentFragment; +/** + * Inserts a node into a range at the start boundary point. + * + * @param node - node to insert + * @param range - a range + */ +export declare function range_insert(node: Node, range: AbstractRange): void; +/** + * Traverses through all contained nodes of a range. + * + * @param range - a range + */ +export declare function range_getContainedNodes(range: Range): Iterable; +/** + * Traverses through all partially contained nodes of a range. + * + * @param range - a range + */ +export declare function range_getPartiallyContainedNodes(range: Range): Iterable; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/RangeAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/RangeAlgorithm.js new file mode 100644 index 0000000..4c1423e --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/RangeAlgorithm.js @@ -0,0 +1,829 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("../dom/interfaces"); +var DOMException_1 = require("../dom/DOMException"); +var util_1 = require("../util"); +var CreateAlgorithm_1 = require("./CreateAlgorithm"); +var TreeAlgorithm_1 = require("./TreeAlgorithm"); +var BoundaryPointAlgorithm_1 = require("./BoundaryPointAlgorithm"); +var CharacterDataAlgorithm_1 = require("./CharacterDataAlgorithm"); +var NodeAlgorithm_1 = require("./NodeAlgorithm"); +var MutationAlgorithm_1 = require("./MutationAlgorithm"); +var TextAlgorithm_1 = require("./TextAlgorithm"); +/** + * Determines if the node's start boundary point is at its end boundary + * point. + * + * @param range - a range + */ +function range_collapsed(range) { + /** + * A range is collapsed if its start node is its end node and its start offset is its end offset. + */ + return (range._startNode === range._endNode && range._startOffset === range._endOffset); +} +exports.range_collapsed = range_collapsed; +/** + * Gets the root node of a range. + * + * @param range - a range + */ +function range_root(range) { + /** + * The root of a live range is the root of its start node. + */ + return TreeAlgorithm_1.tree_rootNode(range._startNode); +} +exports.range_root = range_root; +/** + * Determines if a node is fully contained in a range. + * + * @param node - a node + * @param range - a range + */ +function range_isContained(node, range) { + /** + * A node node is contained in a live range range if node’s root is range’s + * root, and (node, 0) is after range’s start, and (node, node’s length) is + * before range’s end. + */ + return (TreeAlgorithm_1.tree_rootNode(node) === range_root(range) && + BoundaryPointAlgorithm_1.boundaryPoint_position([node, 0], range._start) === interfaces_1.BoundaryPosition.After && + BoundaryPointAlgorithm_1.boundaryPoint_position([node, TreeAlgorithm_1.tree_nodeLength(node)], range._end) === interfaces_1.BoundaryPosition.Before); +} +exports.range_isContained = range_isContained; +/** + * Determines if a node is partially contained in a range. + * + * @param node - a node + * @param range - a range + */ +function range_isPartiallyContained(node, range) { + /** + * A node is partially contained in a live range if it’s an inclusive + * ancestor of the live range’s start node but not its end node, + * or vice versa. + */ + var startCheck = TreeAlgorithm_1.tree_isAncestorOf(range._startNode, node, true); + var endCheck = TreeAlgorithm_1.tree_isAncestorOf(range._endNode, node, true); + return (startCheck && !endCheck) || (!startCheck && endCheck); +} +exports.range_isPartiallyContained = range_isPartiallyContained; +/** + * Sets the start boundary point of a range. + * + * @param range - a range + * @param node - a node + * @param offset - an offset into node + */ +function range_setTheStart(range, node, offset) { + /** + * 1. If node is a doctype, then throw an "InvalidNodeTypeError" DOMException. + * 2. If offset is greater than node’s length, then throw an "IndexSizeError" + * DOMException. + * 3. Let bp be the boundary point (node, offset). + * 4. If these steps were invoked as "set the start" + * 4.1. If bp is after the range’s end, or if range’s root is not equal to + * node’s root, set range’s end to bp. + * 4.2. Set range’s start to bp. + */ + if (util_1.Guard.isDocumentTypeNode(node)) { + throw new DOMException_1.InvalidNodeTypeError(); + } + if (offset > TreeAlgorithm_1.tree_nodeLength(node)) { + throw new DOMException_1.IndexSizeError(); + } + var bp = [node, offset]; + if (range_root(range) !== TreeAlgorithm_1.tree_rootNode(node) || + BoundaryPointAlgorithm_1.boundaryPoint_position(bp, range._end) === interfaces_1.BoundaryPosition.After) { + range._end = bp; + } + range._start = bp; +} +exports.range_setTheStart = range_setTheStart; +/** + * Sets the end boundary point of a range. + * + * @param range - a range + * @param node - a node + * @param offset - an offset into node + */ +function range_setTheEnd(range, node, offset) { + /** + * 1. If node is a doctype, then throw an "InvalidNodeTypeError" DOMException. + * 2. If offset is greater than node’s length, then throw an "IndexSizeError" + * DOMException. + * 3. Let bp be the boundary point (node, offset). + * 4. If these steps were invoked as "set the end" + * 4.1. If bp is before the range’s start, or if range’s root is not equal + * to node’s root, set range’s start to bp. + * 4.2. Set range’s end to bp. + */ + if (util_1.Guard.isDocumentTypeNode(node)) { + throw new DOMException_1.InvalidNodeTypeError(); + } + if (offset > TreeAlgorithm_1.tree_nodeLength(node)) { + throw new DOMException_1.IndexSizeError(); + } + var bp = [node, offset]; + if (range_root(range) !== TreeAlgorithm_1.tree_rootNode(node) || + BoundaryPointAlgorithm_1.boundaryPoint_position(bp, range._start) === interfaces_1.BoundaryPosition.Before) { + range._start = bp; + } + range._end = bp; +} +exports.range_setTheEnd = range_setTheEnd; +/** + * Selects a node. + * + * @param range - a range + * @param node - a node + */ +function range_select(node, range) { + /** + * 1. Let parent be node’s parent. + * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. + */ + var parent = node._parent; + if (parent === null) + throw new DOMException_1.InvalidNodeTypeError(); + /** + * 3. Let index be node’s index. + * 4. Set range’s start to boundary point (parent, index). + * 5. Set range’s end to boundary point (parent, index plus 1). + */ + var index = TreeAlgorithm_1.tree_index(node); + range._start = [parent, index]; + range._end = [parent, index + 1]; +} +exports.range_select = range_select; +/** + * EXtracts the contents of range as a document fragment. + * + * @param range - a range + */ +function range_extract(range) { + var e_1, _a, e_2, _b, e_3, _c; + /** + * 1. Let fragment be a new DocumentFragment node whose node document is + * range’s start node’s node document. + * 2. If range is collapsed, then return fragment. + */ + var fragment = CreateAlgorithm_1.create_documentFragment(range._startNode._nodeDocument); + if (range_collapsed(range)) + return fragment; + /** + * 3. Let original start node, original start offset, original end node, + * and original end offset be range’s start node, start offset, end node, + * and end offset, respectively. + */ + var originalStartNode = range._startNode; + var originalStartOffset = range._startOffset; + var originalEndNode = range._endNode; + var originalEndOffset = range._endOffset; + /** + * 4. If original start node is original end node, and they are a Text, + * ProcessingInstruction, or Comment node: + * 4.1. Let clone be a clone of original start node. + * 4.2. Set the data of clone to the result of substringing data with node + * original start node, offset original start offset, and count original end + * offset minus original start offset. + * 4.3. Append clone to fragment. + * 4.4. Replace data with node original start node, offset original start + * offset, count original end offset minus original start offset, and data + * the empty string. + * 4.5. Return fragment. + */ + if (originalStartNode === originalEndNode && + util_1.Guard.isCharacterDataNode(originalStartNode)) { + var clone = NodeAlgorithm_1.node_clone(originalStartNode); + clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset); + MutationAlgorithm_1.mutation_append(clone, fragment); + CharacterDataAlgorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset, ''); + return fragment; + } + /** + * 5. Let common ancestor be original start node. + * 6. While common ancestor is not an inclusive ancestor of original end + * node, set common ancestor to its own parent. + */ + var commonAncestor = originalStartNode; + while (!TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, commonAncestor, true)) { + if (commonAncestor._parent === null) { + throw new Error("Parent node is null."); + } + commonAncestor = commonAncestor._parent; + } + /** + * 7. Let first partially contained child be null. + * 8. If original start node is not an inclusive ancestor of original end + * node, set first partially contained child to the first child of common + * ancestor that is partially contained in range. + */ + var firstPartiallyContainedChild = null; + if (!TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) { + try { + for (var _d = __values(commonAncestor._children), _e = _d.next(); !_e.done; _e = _d.next()) { + var node = _e.value; + if (range_isPartiallyContained(node, range)) { + firstPartiallyContainedChild = node; + break; + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_e && !_e.done && (_a = _d.return)) _a.call(_d); + } + finally { if (e_1) throw e_1.error; } + } + } + /** + * 9. Let last partially contained child be null. + * 10. If original end node is not an inclusive ancestor of original start + * node, set last partially contained child to the last child of common + * ancestor that is partially contained in range. + */ + var lastPartiallyContainedChild = null; + if (!TreeAlgorithm_1.tree_isAncestorOf(originalStartNode, originalEndNode, true)) { + var children = __spread(commonAncestor._children); + for (var i = children.length - 1; i > 0; i--) { + var node = children[i]; + if (range_isPartiallyContained(node, range)) { + lastPartiallyContainedChild = node; + break; + } + } + } + /** + * 11. Let contained children be a list of all children of common ancestor + * that are contained in range, in tree order. + * 12. If any member of contained children is a doctype, then throw a + * "HierarchyRequestError" DOMException. + */ + var containedChildren = []; + try { + for (var _f = __values(commonAncestor._children), _g = _f.next(); !_g.done; _g = _f.next()) { + var child = _g.value; + if (range_isContained(child, range)) { + if (util_1.Guard.isDocumentTypeNode(child)) { + throw new DOMException_1.HierarchyRequestError(); + } + containedChildren.push(child); + } + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_g && !_g.done && (_b = _f.return)) _b.call(_f); + } + finally { if (e_2) throw e_2.error; } + } + var newNode; + var newOffset; + if (TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) { + /** + * 13. If original start node is an inclusive ancestor of original end node, + * set new node to original start node and new offset to original start + * offset. + */ + newNode = originalStartNode; + newOffset = originalStartOffset; + } + else { + /** + * 14. Otherwise: + * 14.1. Let reference node equal original start node. + * 14.2. While reference node’s parent is not null and is not an inclusive + * ancestor of original end node, set reference node to its parent. + * 14.3. Set new node to the parent of reference node, and new offset to + * one plus reference node’s index. + */ + var referenceNode = originalStartNode; + while (referenceNode._parent !== null && + !TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, referenceNode._parent)) { + referenceNode = referenceNode._parent; + } + /* istanbul ignore next */ + if (referenceNode._parent === null) { + /** + * If reference node’s parent is null, it would be the root of range, + * so would be an inclusive ancestor of original end node, and we could + * not reach this point. + */ + throw new Error("Parent node is null."); + } + newNode = referenceNode._parent; + newOffset = 1 + TreeAlgorithm_1.tree_index(referenceNode); + } + if (util_1.Guard.isCharacterDataNode(firstPartiallyContainedChild)) { + /** + * 15. If first partially contained child is a Text, ProcessingInstruction, + * or Comment node: + * 15.1. Let clone be a clone of original start node. + * 15.2. Set the data of clone to the result of substringing data with + * node original start node, offset original start offset, and count + * original start node’s length minus original start offset. + * 15.3. Append clone to fragment. + * 15.4. Replace data with node original start node, offset original + * start offset, count original start node’s length minus original start + * offset, and data the empty string. + */ + var clone = NodeAlgorithm_1.node_clone(originalStartNode); + clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalStartNode, originalStartOffset, TreeAlgorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset); + MutationAlgorithm_1.mutation_append(clone, fragment); + CharacterDataAlgorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, TreeAlgorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset, ''); + } + else if (firstPartiallyContainedChild !== null) { + /** + * 16. Otherwise, if first partially contained child is not null: + * 16.1. Let clone be a clone of first partially contained child. + * 16.2. Append clone to fragment. + * 16.3. Let subrange be a new live range whose start is (original start + * node, original start offset) and whose end is (first partially + * contained child, first partially contained child’s length). + * 16.4. Let subfragment be the result of extracting subrange. + * 16.5. Append subfragment to clone. + */ + var clone = NodeAlgorithm_1.node_clone(firstPartiallyContainedChild); + MutationAlgorithm_1.mutation_append(clone, fragment); + var subrange = CreateAlgorithm_1.create_range([originalStartNode, originalStartOffset], [firstPartiallyContainedChild, TreeAlgorithm_1.tree_nodeLength(firstPartiallyContainedChild)]); + var subfragment = range_extract(subrange); + MutationAlgorithm_1.mutation_append(subfragment, clone); + } + try { + /** + * 17. For each contained child in contained children, append contained + * child to fragment. + */ + for (var containedChildren_1 = __values(containedChildren), containedChildren_1_1 = containedChildren_1.next(); !containedChildren_1_1.done; containedChildren_1_1 = containedChildren_1.next()) { + var child = containedChildren_1_1.value; + MutationAlgorithm_1.mutation_append(child, fragment); + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (containedChildren_1_1 && !containedChildren_1_1.done && (_c = containedChildren_1.return)) _c.call(containedChildren_1); + } + finally { if (e_3) throw e_3.error; } + } + if (util_1.Guard.isCharacterDataNode(lastPartiallyContainedChild)) { + /** + * 18. If last partially contained child is a Text, ProcessingInstruction, + * or Comment node: + * 18.1. Let clone be a clone of original end node. + * 18.2. Set the data of clone to the result of substringing data with + * node original end node, offset 0, and count original end offset. + * 18.3. Append clone to fragment. + * 18.4. Replace data with node original end node, offset 0, count + * original end offset, and data the empty string. + */ + var clone = NodeAlgorithm_1.node_clone(originalEndNode); + clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalEndNode, 0, originalEndOffset); + MutationAlgorithm_1.mutation_append(clone, fragment); + CharacterDataAlgorithm_1.characterData_replaceData(originalEndNode, 0, originalEndOffset, ''); + } + else if (lastPartiallyContainedChild !== null) { + /** + * 19. Otherwise, if last partially contained child is not null: + * 19.1. Let clone be a clone of last partially contained child. + * 19.2. Append clone to fragment. + * 19.3. Let subrange be a new live range whose start is (last partially + * contained child, 0) and whose end is (original end node, original + * end offset). + * 19.4. Let subfragment be the result of extracting subrange. + * 19.5. Append subfragment to clone. + */ + var clone = NodeAlgorithm_1.node_clone(lastPartiallyContainedChild); + MutationAlgorithm_1.mutation_append(clone, fragment); + var subrange = CreateAlgorithm_1.create_range([lastPartiallyContainedChild, 0], [originalEndNode, originalEndOffset]); + var subfragment = range_extract(subrange); + MutationAlgorithm_1.mutation_append(subfragment, clone); + } + /** + * 20. Set range’s start and end to (new node, new offset). + */ + range._start = [newNode, newOffset]; + range._end = [newNode, newOffset]; + /** + * 21. Return fragment. + */ + return fragment; +} +exports.range_extract = range_extract; +/** + * Clones the contents of range as a document fragment. + * + * @param range - a range + */ +function range_cloneTheContents(range) { + var e_4, _a, e_5, _b, e_6, _c; + /** + * 1. Let fragment be a new DocumentFragment node whose node document + * is range’s start node’s node document. + * 2. If range is collapsed, then return fragment. + */ + var fragment = CreateAlgorithm_1.create_documentFragment(range._startNode._nodeDocument); + if (range_collapsed(range)) + return fragment; + /** + * 3. Let original start node, original start offset, original end node, + * and original end offset be range’s start node, start offset, end node, + * and end offset, respectively. + * 4. If original start node is original end node, and they are a Text, + * ProcessingInstruction, or Comment node: + * 4.1. Let clone be a clone of original start node. + * 4.2. Set the data of clone to the result of substringing data with node + * original start node, offset original start offset, and count original end + * offset minus original start offset. + * 4.3. Append clone to fragment. + * 4.5. Return fragment. + */ + var originalStartNode = range._startNode; + var originalStartOffset = range._startOffset; + var originalEndNode = range._endNode; + var originalEndOffset = range._endOffset; + if (originalStartNode === originalEndNode && + util_1.Guard.isCharacterDataNode(originalStartNode)) { + var clone = NodeAlgorithm_1.node_clone(originalStartNode); + clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset); + MutationAlgorithm_1.mutation_append(clone, fragment); + } + /** + * 5. Let common ancestor be original start node. + * 6. While common ancestor is not an inclusive ancestor of original end + * node, set common ancestor to its own parent. + */ + var commonAncestor = originalStartNode; + while (!TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, commonAncestor, true)) { + if (commonAncestor._parent === null) { + throw new Error("Parent node is null."); + } + commonAncestor = commonAncestor._parent; + } + /** + * 7. Let first partially contained child be null. + * 8. If original start node is not an inclusive ancestor of original end + * node, set first partially contained child to the first child of common + * ancestor that is partially contained in range. + */ + var firstPartiallyContainedChild = null; + if (!TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) { + try { + for (var _d = __values(commonAncestor._children), _e = _d.next(); !_e.done; _e = _d.next()) { + var node = _e.value; + if (range_isPartiallyContained(node, range)) { + firstPartiallyContainedChild = node; + break; + } + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (_e && !_e.done && (_a = _d.return)) _a.call(_d); + } + finally { if (e_4) throw e_4.error; } + } + } + /** + * 9. Let last partially contained child be null. + * 10. If original end node is not an inclusive ancestor of original start + * node, set last partially contained child to the last child of common + * ancestor that is partially contained in range. + */ + var lastPartiallyContainedChild = null; + if (!TreeAlgorithm_1.tree_isAncestorOf(originalStartNode, originalEndNode, true)) { + var children = __spread(commonAncestor._children); + for (var i = children.length - 1; i > 0; i--) { + var node = children[i]; + if (range_isPartiallyContained(node, range)) { + lastPartiallyContainedChild = node; + break; + } + } + } + /** + * 11. Let contained children be a list of all children of common ancestor + * that are contained in range, in tree order. + * 12. If any member of contained children is a doctype, then throw a + * "HierarchyRequestError" DOMException. + */ + var containedChildren = []; + try { + for (var _f = __values(commonAncestor._children), _g = _f.next(); !_g.done; _g = _f.next()) { + var child = _g.value; + if (range_isContained(child, range)) { + if (util_1.Guard.isDocumentTypeNode(child)) { + throw new DOMException_1.HierarchyRequestError(); + } + containedChildren.push(child); + } + } + } + catch (e_5_1) { e_5 = { error: e_5_1 }; } + finally { + try { + if (_g && !_g.done && (_b = _f.return)) _b.call(_f); + } + finally { if (e_5) throw e_5.error; } + } + if (util_1.Guard.isCharacterDataNode(firstPartiallyContainedChild)) { + /** + * 13. If first partially contained child is a Text, ProcessingInstruction, + * or Comment node: + * 13.1. Let clone be a clone of original start node. + * 13.2. Set the data of clone to the result of substringing data with + * node original start node, offset original start offset, and count + * original start node’s length minus original start offset. + * 13.3. Append clone to fragment. + */ + var clone = NodeAlgorithm_1.node_clone(originalStartNode); + clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalStartNode, originalStartOffset, TreeAlgorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset); + MutationAlgorithm_1.mutation_append(clone, fragment); + } + else if (firstPartiallyContainedChild !== null) { + /** + * 14. Otherwise, if first partially contained child is not null: + * 14.1. Let clone be a clone of first partially contained child. + * 14.2. Append clone to fragment. + * 14.3. Let subrange be a new live range whose start is (original start + * node, original start offset) and whose end is (first partially + * contained child, first partially contained child’s length). + * 14.4. Let subfragment be the result of cloning the contents of + * subrange. + * 14.5. Append subfragment to clone. + */ + var clone = NodeAlgorithm_1.node_clone(firstPartiallyContainedChild); + MutationAlgorithm_1.mutation_append(clone, fragment); + var subrange = CreateAlgorithm_1.create_range([originalStartNode, originalStartOffset], [firstPartiallyContainedChild, TreeAlgorithm_1.tree_nodeLength(firstPartiallyContainedChild)]); + var subfragment = range_cloneTheContents(subrange); + MutationAlgorithm_1.mutation_append(subfragment, clone); + } + try { + /** + * 15. For each contained child in contained children, append contained + * child to fragment. + * 15.1. Let clone be a clone of contained child with the clone children + * flag set. + * 15.2. Append clone to fragment. + */ + for (var containedChildren_2 = __values(containedChildren), containedChildren_2_1 = containedChildren_2.next(); !containedChildren_2_1.done; containedChildren_2_1 = containedChildren_2.next()) { + var child = containedChildren_2_1.value; + var clone = NodeAlgorithm_1.node_clone(child); + MutationAlgorithm_1.mutation_append(clone, fragment); + } + } + catch (e_6_1) { e_6 = { error: e_6_1 }; } + finally { + try { + if (containedChildren_2_1 && !containedChildren_2_1.done && (_c = containedChildren_2.return)) _c.call(containedChildren_2); + } + finally { if (e_6) throw e_6.error; } + } + if (util_1.Guard.isCharacterDataNode(lastPartiallyContainedChild)) { + /** + * 16. If last partially contained child is a Text, ProcessingInstruction, + * or Comment node: + * 16.1. Let clone be a clone of original end node. + * 16.2. Set the data of clone to the result of substringing data with + * node original end node, offset 0, and count original end offset. + * 16.3. Append clone to fragment. + */ + var clone = NodeAlgorithm_1.node_clone(originalEndNode); + clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalEndNode, 0, originalEndOffset); + MutationAlgorithm_1.mutation_append(clone, fragment); + } + else if (lastPartiallyContainedChild !== null) { + /** + * 17. Otherwise, if last partially contained child is not null: + * 17.1. Let clone be a clone of last partially contained child. + * 17.2. Append clone to fragment. + * 17.3. Let subrange be a new live range whose start is (last partially + * contained child, 0) and whose end is (original end node, original + * end offset). + * 17.4. Let subfragment be the result of cloning the contents of subrange. + * 17.5. Append subfragment to clone. + */ + var clone = NodeAlgorithm_1.node_clone(lastPartiallyContainedChild); + fragment.append(clone); + var subrange = CreateAlgorithm_1.create_range([lastPartiallyContainedChild, 0], [originalEndNode, originalEndOffset]); + var subfragment = range_extract(subrange); + MutationAlgorithm_1.mutation_append(subfragment, clone); + } + /** + * 18. Return fragment. + */ + return fragment; +} +exports.range_cloneTheContents = range_cloneTheContents; +/** + * Inserts a node into a range at the start boundary point. + * + * @param node - node to insert + * @param range - a range + */ +function range_insert(node, range) { + var e_7, _a; + /** + * 1. If range’s start node is a ProcessingInstruction or Comment node, is a + * Text node whose parent is null, or is node, then throw a + * "HierarchyRequestError" DOMException. + */ + if (util_1.Guard.isProcessingInstructionNode(range._startNode) || + util_1.Guard.isCommentNode(range._startNode) || + (util_1.Guard.isTextNode(range._startNode) && range._startNode._parent === null) || + range._startNode === node) { + throw new DOMException_1.HierarchyRequestError(); + } + /** + * 2. Let referenceNode be null. + * 3. If range’s start node is a Text node, set referenceNode to that Text + * node. + * 4. Otherwise, set referenceNode to the child of start node whose index is + * start offset, and null if there is no such child. + */ + var referenceNode = null; + if (util_1.Guard.isTextNode(range._startNode)) { + referenceNode = range._startNode; + } + else { + var index = 0; + try { + for (var _b = __values(range._startNode._children), _c = _b.next(); !_c.done; _c = _b.next()) { + var child = _c.value; + if (index === range._startOffset) { + referenceNode = child; + break; + } + index++; + } + } + catch (e_7_1) { e_7 = { error: e_7_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_7) throw e_7.error; } + } + } + /** + * 5. Let parent be range’s start node if referenceNode is null, and + * referenceNode’s parent otherwise. + */ + var parent; + if (referenceNode === null) { + parent = range._startNode; + } + else { + if (referenceNode._parent === null) { + throw new Error("Parent node is null."); + } + parent = referenceNode._parent; + } + /** + * 6. Ensure pre-insertion validity of node into parent before referenceNode. + */ + MutationAlgorithm_1.mutation_ensurePreInsertionValidity(node, parent, referenceNode); + /** + * 7. If range’s start node is a Text node, set referenceNode to the result + * of splitting it with offset range’s start offset. + */ + if (util_1.Guard.isTextNode(range._startNode)) { + referenceNode = TextAlgorithm_1.text_split(range._startNode, range._startOffset); + } + /** + * 8. If node is referenceNode, set referenceNode to its next sibling. + */ + if (node === referenceNode) { + referenceNode = node._nextSibling; + } + /** + * 9. If node’s parent is not null, remove node from its parent. + */ + if (node._parent !== null) { + MutationAlgorithm_1.mutation_remove(node, node._parent); + } + /** + * 10. Let newOffset be parent’s length if referenceNode is null, and + * referenceNode’s index otherwise. + */ + var newOffset = (referenceNode === null ? + TreeAlgorithm_1.tree_nodeLength(parent) : TreeAlgorithm_1.tree_index(referenceNode)); + /** + * 11. Increase newOffset by node’s length if node is a DocumentFragment + * node, and one otherwise. + */ + if (util_1.Guard.isDocumentFragmentNode(node)) { + newOffset += TreeAlgorithm_1.tree_nodeLength(node); + } + else { + newOffset++; + } + /** + * 12. Pre-insert node into parent before referenceNode. + */ + MutationAlgorithm_1.mutation_preInsert(node, parent, referenceNode); + /** + * 13. If range is collapsed, then set range’s end to (parent, newOffset). + */ + if (range_collapsed(range)) { + range._end = [parent, newOffset]; + } +} +exports.range_insert = range_insert; +/** + * Traverses through all contained nodes of a range. + * + * @param range - a range + */ +function range_getContainedNodes(range) { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + var container = range.commonAncestorContainer; + var currentNode = TreeAlgorithm_1.tree_getFirstDescendantNode(container); + return { + next: function () { + while (currentNode && !range_isContained(currentNode, range)) { + currentNode = TreeAlgorithm_1.tree_getNextDescendantNode(container, currentNode); + } + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + currentNode = TreeAlgorithm_1.tree_getNextDescendantNode(container, currentNode); + return result; + } + } + }; + }, + _a; +} +exports.range_getContainedNodes = range_getContainedNodes; +/** + * Traverses through all partially contained nodes of a range. + * + * @param range - a range + */ +function range_getPartiallyContainedNodes(range) { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + var container = range.commonAncestorContainer; + var currentNode = TreeAlgorithm_1.tree_getFirstDescendantNode(container); + return { + next: function () { + while (currentNode && !range_isPartiallyContained(currentNode, range)) { + currentNode = TreeAlgorithm_1.tree_getNextDescendantNode(container, currentNode); + } + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + currentNode = TreeAlgorithm_1.tree_getNextDescendantNode(container, currentNode); + return result; + } + } + }; + }, + _a; +} +exports.range_getPartiallyContainedNodes = range_getPartiallyContainedNodes; +//# sourceMappingURL=RangeAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/RangeAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/RangeAlgorithm.js.map new file mode 100644 index 0000000..085dd7a --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/RangeAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RangeAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/RangeAlgorithm.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAG0B;AAC1B,oDAE4B;AAC5B,gCAA+B;AAC/B,qDAAyE;AACzE,iDAGwB;AACxB,mEAAiE;AACjE,mEAAiG;AACjG,iDAA4C;AAC5C,yDAG4B;AAC5B,iDAA4C;AAE5C;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,KAAoB;IAClD;;OAEG;IACH,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,YAAY,KAAK,KAAK,CAAC,UAAU,CAAC,CAAA;AACzF,CAAC;AALD,0CAKC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CAAC,KAAoB;IAC7C;;OAEG;IACH,OAAO,6BAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;AACxC,CAAC;AALD,gCAKC;AAED;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,IAAU,EAAE,KAAoB;IAChE;;;;OAIG;IACH,OAAO,CAAC,6BAAa,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,KAAK,CAAC;QAC/C,+CAAsB,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,6BAAgB,CAAC,KAAK;QAC1E,+CAAsB,CAAC,CAAC,IAAI,EAAE,+BAAe,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,6BAA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4EAwBC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/SelectorsAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/SelectorsAlgorithm.d.ts new file mode 100644 index 0000000..d032daa --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/SelectorsAlgorithm.d.ts @@ -0,0 +1,8 @@ +import { Element, Node } from "../dom/interfaces"; +/** + * Matches elements with the given selectors. + * + * @param selectors - selectors + * @param node - the node to match against + */ +export declare function selectors_scopeMatchASelectorsString(selectors: string, node: Node): Element[]; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/SelectorsAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/SelectorsAlgorithm.js new file mode 100644 index 0000000..306ff02 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/SelectorsAlgorithm.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMException_1 = require("../dom/DOMException"); +/** + * Matches elements with the given selectors. + * + * @param selectors - selectors + * @param node - the node to match against + */ +function selectors_scopeMatchASelectorsString(selectors, node) { + /** + * TODO: Selectors + * 1. Let s be the result of parse a selector selectors. [SELECTORS4] + * 2. If s is failure, then throw a "SyntaxError" DOMException. + * 3. Return the result of match a selector against a tree with s and node’s + * root using scoping root node. [SELECTORS4]. + */ + throw new DOMException_1.NotSupportedError(); +} +exports.selectors_scopeMatchASelectorsString = selectors_scopeMatchASelectorsString; +//# sourceMappingURL=SelectorsAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/SelectorsAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/SelectorsAlgorithm.js.map new file mode 100644 index 0000000..d73b38c --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/SelectorsAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"SelectorsAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/SelectorsAlgorithm.ts"],"names":[],"mappings":";;AAAA,oDAAuD;AAGvD;;;;;GAKG;AAEH,SAAgB,oCAAoC,CAAC,SAAiB,EAAE,IAAU;IAEhF;;;;;;OAMG;IACH,MAAM,IAAI,gCAAiB,EAAE,CAAA;AAC/B,CAAC;AAVD,oFAUC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/ShadowTreeAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/ShadowTreeAlgorithm.d.ts new file mode 100644 index 0000000..cfabdd8 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/ShadowTreeAlgorithm.d.ts @@ -0,0 +1,57 @@ +import { Slotable, Slot, Element, Node } from "../dom/interfaces"; +/** + * Signals a slot change to the given slot. + * + * @param slot - a slot + */ +export declare function shadowTree_signalASlotChange(slot: Slot): void; +/** + * Determines whether a the shadow tree of the given element node is + * connected to a document node. + * + * @param element - an element node of the shadow tree + */ +export declare function shadowTree_isConnected(element: Element): boolean; +/** + * Determines whether a slotable is assigned. + * + * @param slotable - a slotable + */ +export declare function shadowTree_isAssigned(slotable: Slotable): boolean; +/** + * Finds a slot for the given slotable. + * + * @param slotable - a slotable + * @param openFlag - `true` to search open shadow tree's only + */ +export declare function shadowTree_findASlot(slotable: Slotable, openFlag?: boolean): Slot | null; +/** + * Finds slotables for the given slot. + * + * @param slot - a slot + */ +export declare function shadowTree_findSlotables(slot: Slot): Slotable[]; +/** + * Finds slotables for the given slot. + * + * @param slot - a slot + */ +export declare function shadowTree_findFlattenedSlotables(slot: Slot): Slotable[]; +/** + * Assigns slotables to the given slot. + * + * @param slot - a slot + */ +export declare function shadowTree_assignSlotables(slot: Slot): void; +/** + * Assigns slotables to all nodes of a tree. + * + * @param root - root node + */ +export declare function shadowTree_assignSlotablesForATree(root: Node): void; +/** + * Assigns a slot to a slotables. + * + * @param slotable - a slotable + */ +export declare function shadowTree_assignASlot(slotable: Slotable): void; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/ShadowTreeAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/ShadowTreeAlgorithm.js new file mode 100644 index 0000000..e914830 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/ShadowTreeAlgorithm.js @@ -0,0 +1,316 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("../dom/DOMImpl"); +var util_1 = require("../util"); +var util_2 = require("@oozcitak/util"); +var TreeAlgorithm_1 = require("./TreeAlgorithm"); +var MutationObserverAlgorithm_1 = require("./MutationObserverAlgorithm"); +/** + * Signals a slot change to the given slot. + * + * @param slot - a slot + */ +function shadowTree_signalASlotChange(slot) { + /** + * 1. Append slot to slot’s relevant agent’s signal slots. + * 2. Queue a mutation observer microtask. + */ + var window = DOMImpl_1.dom.window; + window._signalSlots.add(slot); + MutationObserverAlgorithm_1.observer_queueAMutationObserverMicrotask(); +} +exports.shadowTree_signalASlotChange = shadowTree_signalASlotChange; +/** + * Determines whether a the shadow tree of the given element node is + * connected to a document node. + * + * @param element - an element node of the shadow tree + */ +function shadowTree_isConnected(element) { + /** + * An element is connected if its shadow-including root is a document. + */ + return util_1.Guard.isDocumentNode(TreeAlgorithm_1.tree_rootNode(element, true)); +} +exports.shadowTree_isConnected = shadowTree_isConnected; +/** + * Determines whether a slotable is assigned. + * + * @param slotable - a slotable + */ +function shadowTree_isAssigned(slotable) { + /** + * A slotable is assigned if its assigned slot is non-null. + */ + return (slotable._assignedSlot !== null); +} +exports.shadowTree_isAssigned = shadowTree_isAssigned; +/** + * Finds a slot for the given slotable. + * + * @param slotable - a slotable + * @param openFlag - `true` to search open shadow tree's only + */ +function shadowTree_findASlot(slotable, openFlag) { + if (openFlag === void 0) { openFlag = false; } + /** + * 1. If slotable’s parent is null, then return null. + * 2. Let shadow be slotable’s parent’s shadow root. + * 3. If shadow is null, then return null. + * 4. If the open flag is set and shadow’s mode is not "open", then + * return null. + * 5. Return the first slot in tree order in shadow’s descendants whose name + * is slotable’s name, if any, and null otherwise. + */ + var node = util_1.Cast.asNode(slotable); + var parent = node._parent; + if (parent === null) + return null; + var shadow = parent._shadowRoot || null; + if (shadow === null) + return null; + if (openFlag && shadow._mode !== "open") + return null; + var child = TreeAlgorithm_1.tree_getFirstDescendantNode(shadow, false, true, function (e) { return util_1.Guard.isSlot(e); }); + while (child !== null) { + if (child._name === slotable._name) + return child; + child = TreeAlgorithm_1.tree_getNextDescendantNode(shadow, child, false, true, function (e) { return util_1.Guard.isSlot(e); }); + } + return null; +} +exports.shadowTree_findASlot = shadowTree_findASlot; +/** + * Finds slotables for the given slot. + * + * @param slot - a slot + */ +function shadowTree_findSlotables(slot) { + var e_1, _a; + /** + * 1. Let result be an empty list. + * 2. If slot’s root is not a shadow root, then return result. + */ + var result = []; + var root = TreeAlgorithm_1.tree_rootNode(slot); + if (!util_1.Guard.isShadowRoot(root)) + return result; + /** + * 3. Let host be slot’s root’s host. + * 4. For each slotable child of host, slotable, in tree order: + */ + var host = root._host; + try { + for (var _b = __values(host._children), _c = _b.next(); !_c.done; _c = _b.next()) { + var slotable = _c.value; + if (util_1.Guard.isSlotable(slotable)) { + /** + * 4.1. Let foundSlot be the result of finding a slot given slotable. + * 4.2. If foundSlot is slot, then append slotable to result. + */ + var foundSlot = shadowTree_findASlot(slotable); + if (foundSlot === slot) { + result.push(slotable); + } + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + /** + * 5. Return result. + */ + return result; +} +exports.shadowTree_findSlotables = shadowTree_findSlotables; +/** + * Finds slotables for the given slot. + * + * @param slot - a slot + */ +function shadowTree_findFlattenedSlotables(slot) { + var e_2, _a, e_3, _b; + /** + * 1. Let result be an empty list. + * 2. If slot’s root is not a shadow root, then return result. + */ + var result = []; + var root = TreeAlgorithm_1.tree_rootNode(slot); + if (!util_1.Guard.isShadowRoot(root)) + return result; + /** + * 3. Let slotables be the result of finding slotables given slot. + * 4. If slotables is the empty list, then append each slotable child of + * slot, in tree order, to slotables. + */ + var slotables = shadowTree_findSlotables(slot); + if (util_2.isEmpty(slotables)) { + try { + for (var _c = __values(slot._children), _d = _c.next(); !_d.done; _d = _c.next()) { + var slotable = _d.value; + if (util_1.Guard.isSlotable(slotable)) { + slotables.push(slotable); + } + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_d && !_d.done && (_a = _c.return)) _a.call(_c); + } + finally { if (e_2) throw e_2.error; } + } + } + try { + /** + * 5. For each node in slotables: + */ + for (var slotables_1 = __values(slotables), slotables_1_1 = slotables_1.next(); !slotables_1_1.done; slotables_1_1 = slotables_1.next()) { + var node = slotables_1_1.value; + /** + * 5.1. If node is a slot whose root is a shadow root, then: + */ + if (util_1.Guard.isSlot(node) && util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(node))) { + /** + * 5.1.1. Let temporaryResult be the result of finding flattened slotables given node. + * 5.1.2. Append each slotable in temporaryResult, in order, to result. + */ + var temporaryResult = shadowTree_findFlattenedSlotables(node); + result.push.apply(result, __spread(temporaryResult)); + } + else { + /** + * 5.2. Otherwise, append node to result. + */ + result.push(node); + } + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (slotables_1_1 && !slotables_1_1.done && (_b = slotables_1.return)) _b.call(slotables_1); + } + finally { if (e_3) throw e_3.error; } + } + /** + * 6. Return result. + */ + return result; +} +exports.shadowTree_findFlattenedSlotables = shadowTree_findFlattenedSlotables; +/** + * Assigns slotables to the given slot. + * + * @param slot - a slot + */ +function shadowTree_assignSlotables(slot) { + var e_4, _a; + /** + * 1. Let slotables be the result of finding slotables for slot. + * 2. If slotables and slot’s assigned nodes are not identical, then run + * signal a slot change for slot. + */ + var slotables = shadowTree_findSlotables(slot); + if (slotables.length === slot._assignedNodes.length) { + var nodesIdentical = true; + for (var i = 0; i < slotables.length; i++) { + if (slotables[i] !== slot._assignedNodes[i]) { + nodesIdentical = false; + break; + } + } + if (!nodesIdentical) { + shadowTree_signalASlotChange(slot); + } + } + /** + * 3. Set slot’s assigned nodes to slotables. + * 4. For each slotable in slotables, set slotable’s assigned slot to slot. + */ + slot._assignedNodes = slotables; + try { + for (var slotables_2 = __values(slotables), slotables_2_1 = slotables_2.next(); !slotables_2_1.done; slotables_2_1 = slotables_2.next()) { + var slotable = slotables_2_1.value; + slotable._assignedSlot = slot; + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (slotables_2_1 && !slotables_2_1.done && (_a = slotables_2.return)) _a.call(slotables_2); + } + finally { if (e_4) throw e_4.error; } + } +} +exports.shadowTree_assignSlotables = shadowTree_assignSlotables; +/** + * Assigns slotables to all nodes of a tree. + * + * @param root - root node + */ +function shadowTree_assignSlotablesForATree(root) { + /** + * To assign slotables for a tree, given a node root, run assign slotables + * for each slot slot in root’s inclusive descendants, in tree order. + */ + var descendant = TreeAlgorithm_1.tree_getFirstDescendantNode(root, true, false, function (e) { return util_1.Guard.isSlot(e); }); + while (descendant !== null) { + shadowTree_assignSlotables(descendant); + descendant = TreeAlgorithm_1.tree_getNextDescendantNode(root, descendant, true, false, function (e) { return util_1.Guard.isSlot(e); }); + } +} +exports.shadowTree_assignSlotablesForATree = shadowTree_assignSlotablesForATree; +/** + * Assigns a slot to a slotables. + * + * @param slotable - a slotable + */ +function shadowTree_assignASlot(slotable) { + /** + * 1. Let slot be the result of finding a slot with slotable. + * 2. If slot is non-null, then run assign slotables for slot. + */ + var slot = shadowTree_findASlot(slotable); + if (slot !== null) { + shadowTree_assignSlotables(slot); + } +} +exports.shadowTree_assignASlot = shadowTree_assignASlot; +//# sourceMappingURL=ShadowTreeAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/ShadowTreeAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/ShadowTreeAlgorithm.js.map new file mode 100644 index 0000000..667ee5e --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/ShadowTreeAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ShadowTreeAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/ShadowTreeAlgorithm.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAoC;AAEpC,gCAAqC;AACrC,uCAAwC;AACxC,iDAEwB;AACxB,yEAAsF;AAEtF;;;;GAIG;AACH,SAAgB,4BAA4B,CAAC,IAAU;IACrD;;;OAGG;IACH,IAAM,MAAM,GAAG,aAAG,CAAC,MAAM,CAAA;IACzB,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAC7B,oEAAwC,EAAE,CAAA;AAC5C,CAAC;AARD,oEAQC;AAED;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,OAAgB;IACrD;;OAEG;IACH,OAAO,YAAK,CAAC,cAAc,CAAC,6BAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;AAC3D,CAAC;AALD,wDAKC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,QAAkB;IACtD;;OAEG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GAAG,2CAA2B,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,UAAC,CAAO,IAAK,OAAA,YAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAf,CAAe,CAAC,CAAA;IAC7F,OAAO,UAAU,KAAK,IAAI,EAAE;QAC1B,0BAA0B,CAAC,UAAkB,CAAC,CAAA;QAC9C,UAAU,GAAG,0CAA0B,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,UAAC,CAAO,IAAK,OAAA,YAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAf,CAAe,CAAC,CAAA;KACrG;AACH,CAAC;AAVD,gFAUC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,QAAkB;IACvD;;;OAGG;IACH,IAAM,IAAI,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAA;IAC3C,IAAI,IAAI,KAAK,IAAI,EAAE;QACjB,0BAA0B,CAAC,IAAI,CAAC,CAAA;KACjC;AACH,CAAC;AATD,wDASC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/TextAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/TextAlgorithm.d.ts new file mode 100644 index 0000000..156ed81 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/TextAlgorithm.d.ts @@ -0,0 +1,30 @@ +import { Node, Text } from "../dom/interfaces"; +/** + * Returns node with its adjacent text and cdata node siblings. + * + * @param node - a node + * @param self - whether to include node itself + */ +export declare function text_contiguousTextNodes(node: Text, self?: boolean): Iterable; +/** + * Returns node with its adjacent text node siblings. + * + * @param node - a node + * @param self - whether to include node itself + */ +export declare function text_contiguousExclusiveTextNodes(node: Text, self?: boolean): Iterable; +/** + * Returns the concatenation of the data of all the Text node descendants of + * node, in tree order. + * + * @param node - a node + */ +export declare function text_descendantTextContent(node: Node): string; +/** + * Splits data at the given offset and returns the remainder as a text + * node. + * + * @param node - a text node + * @param offset - the offset at which to split the nodes. + */ +export declare function text_split(node: Text, offset: number): Text; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/TextAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/TextAlgorithm.js new file mode 100644 index 0000000..4115397 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/TextAlgorithm.js @@ -0,0 +1,226 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("../dom/DOMImpl"); +var util_1 = require("../util"); +var DOMException_1 = require("../dom/DOMException"); +var CreateAlgorithm_1 = require("./CreateAlgorithm"); +var TreeAlgorithm_1 = require("./TreeAlgorithm"); +var CharacterDataAlgorithm_1 = require("./CharacterDataAlgorithm"); +var MutationAlgorithm_1 = require("./MutationAlgorithm"); +/** + * Returns node with its adjacent text and cdata node siblings. + * + * @param node - a node + * @param self - whether to include node itself + */ +function text_contiguousTextNodes(node, self) { + var _a; + if (self === void 0) { self = false; } + /** + * The contiguous Text nodes of a node node are node, node’s previous + * sibling Text node, if any, and its contiguous Text nodes, and node’s next + * sibling Text node, if any, and its contiguous Text nodes, avoiding any + * duplicates. + */ + return _a = {}, + _a[Symbol.iterator] = function () { + var currentNode = node; + while (currentNode && util_1.Guard.isTextNode(currentNode._previousSibling)) { + currentNode = currentNode._previousSibling; + } + return { + next: function () { + if (currentNode && (!self && currentNode === node)) { + if (util_1.Guard.isTextNode(currentNode._nextSibling)) { + currentNode = currentNode._nextSibling; + } + else { + currentNode = null; + } + } + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + if (util_1.Guard.isTextNode(currentNode._nextSibling)) { + currentNode = currentNode._nextSibling; + } + else { + currentNode = null; + } + return result; + } + } + }; + }, + _a; +} +exports.text_contiguousTextNodes = text_contiguousTextNodes; +/** + * Returns node with its adjacent text node siblings. + * + * @param node - a node + * @param self - whether to include node itself + */ +function text_contiguousExclusiveTextNodes(node, self) { + var _a; + if (self === void 0) { self = false; } + /** + * The contiguous exclusive Text nodes of a node node are node, node’s + * previous sibling exclusive Text node, if any, and its contiguous + * exclusive Text nodes, and node’s next sibling exclusive Text node, + * if any, and its contiguous exclusive Text nodes, avoiding any duplicates. + */ + return _a = {}, + _a[Symbol.iterator] = function () { + var currentNode = node; + while (currentNode && util_1.Guard.isExclusiveTextNode(currentNode._previousSibling)) { + currentNode = currentNode._previousSibling; + } + return { + next: function () { + if (currentNode && (!self && currentNode === node)) { + if (util_1.Guard.isExclusiveTextNode(currentNode._nextSibling)) { + currentNode = currentNode._nextSibling; + } + else { + currentNode = null; + } + } + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + if (util_1.Guard.isExclusiveTextNode(currentNode._nextSibling)) { + currentNode = currentNode._nextSibling; + } + else { + currentNode = null; + } + return result; + } + } + }; + }, + _a; +} +exports.text_contiguousExclusiveTextNodes = text_contiguousExclusiveTextNodes; +/** + * Returns the concatenation of the data of all the Text node descendants of + * node, in tree order. + * + * @param node - a node + */ +function text_descendantTextContent(node) { + /** + * The descendant text content of a node node is the concatenation of the + * data of all the Text node descendants of node, in tree order. + */ + var contents = ''; + var text = TreeAlgorithm_1.tree_getFirstDescendantNode(node, false, false, function (e) { return util_1.Guard.isTextNode(e); }); + while (text !== null) { + contents += text._data; + text = TreeAlgorithm_1.tree_getNextDescendantNode(node, text, false, false, function (e) { return util_1.Guard.isTextNode(e); }); + } + return contents; +} +exports.text_descendantTextContent = text_descendantTextContent; +/** + * Splits data at the given offset and returns the remainder as a text + * node. + * + * @param node - a text node + * @param offset - the offset at which to split the nodes. + */ +function text_split(node, offset) { + var e_1, _a; + /** + * 1. Let length be node’s length. + * 2. If offset is greater than length, then throw an "IndexSizeError" + * DOMException. + */ + var length = node._data.length; + if (offset > length) { + throw new DOMException_1.IndexSizeError(); + } + /** + * 3. Let count be length minus offset. + * 4. Let new data be the result of substringing data with node node, + * offset offset, and count count. + * 5. Let new node be a new Text node, with the same node document as node. + * Set new node’s data to new data. + * 6. Let parent be node’s parent. + * 7. If parent is not null, then: + */ + var count = length - offset; + var newData = CharacterDataAlgorithm_1.characterData_substringData(node, offset, count); + var newNode = CreateAlgorithm_1.create_text(node._nodeDocument, newData); + var parent = node._parent; + if (parent !== null) { + /** + * 7.1. Insert new node into parent before node’s next sibling. + */ + MutationAlgorithm_1.mutation_insert(newNode, parent, node._nextSibling); + try { + /** + * 7.2. For each live range whose start node is node and start offset is + * greater than offset, set its start node to new node and decrease its + * start offset by offset. + * 7.3. For each live range whose end node is node and end offset is greater + * than offset, set its end node to new node and decrease its end offset + * by offset. + * 7.4. For each live range whose start node is parent and start offset is + * equal to the index of node plus 1, increase its start offset by 1. + * 7.5. For each live range whose end node is parent and end offset is equal + * to the index of node plus 1, increase its end offset by 1. + */ + for (var _b = __values(DOMImpl_1.dom.rangeList), _c = _b.next(); !_c.done; _c = _b.next()) { + var range = _c.value; + if (range._start[0] === node && range._start[1] > offset) { + range._start[0] = newNode; + range._start[1] -= offset; + } + if (range._end[0] === node && range._end[1] > offset) { + range._end[0] = newNode; + range._end[1] -= offset; + } + var index = TreeAlgorithm_1.tree_index(node); + if (range._start[0] === parent && range._start[1] === index + 1) { + range._start[1]++; + } + if (range._end[0] === parent && range._end[1] === index + 1) { + range._end[1]++; + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + } + /** + * 8. Replace data with node node, offset offset, count count, and data + * the empty string. + * 9. Return new node. + */ + CharacterDataAlgorithm_1.characterData_replaceData(node, offset, count, ''); + return newNode; +} +exports.text_split = text_split; +//# sourceMappingURL=TextAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/TextAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/TextAlgorithm.js.map new file mode 100644 index 0000000..aa4fc7d --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/TextAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/TextAlgorithm.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,0CAAoC;AAEpC,gCAA+B;AAC/B,oDAAoD;AACpD,qDAA+C;AAC/C,iDAEwB;AACxB,mEAEiC;AACjC,yDAAqD;AAErD;;;;;GAKG;AACH,SAAgB,wBAAwB,CAAC,IAAU,EAAE,IAAqB;;IAArB,qBAAA,EAAA,YAAqB;IACxE;;;;;OAKG;IACH;QACE,GAAC,MAAM,CAAC,QAAQ,IAAhB;YAEE,IAAI,WAAW,GAAgB,IAAI,CAAA;YACnC,OAAO,WAAW,IAAI,YAAK,CAAC,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE;gBACpE,WAAW,GAAG,WAAW,CAAC,gBAAgB,CAAA;aAC3C;YAED,OAAO;gBACL,IAAI;oBACF,IAAI,WAAW,IAAI,CAAC,CAAC,IAAI,IAAI,WAAW,KAAK,IAAI,CAAC,EAAE;wBAClD,IAAI,YAAK,CAAC,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE;4BAC9C,WAAW,GAAG,WAAW,CAAC,YAAY,CAAA;yBACvC;6BAAM;4BACL,WAAW,GAAG,IAAI,CAAA;yBACnB;qBACF;oBAED,IAAI,WAAW,KAAK,IAAI,EAAE;wBACxB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;qBACnC;yBAAM;wBACL,IAAM,MAAM,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,CAAA;wBAClD,IAAI,YAA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AApED,gCAoEC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/TraversalAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/TraversalAlgorithm.d.ts new file mode 100644 index 0000000..bd4cfb8 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/TraversalAlgorithm.d.ts @@ -0,0 +1,8 @@ +import { FilterResult, NodeIterator, Node, TreeWalker } from "../dom/interfaces"; +/** + * Applies the filter to the given node and returns the result. + * + * @param traverser - the `NodeIterator` or `TreeWalker` instance + * @param node - the node to filter + */ +export declare function traversal_filter(traverser: NodeIterator | TreeWalker, node: Node): FilterResult; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/TraversalAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/TraversalAlgorithm.js new file mode 100644 index 0000000..227fe92 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/TraversalAlgorithm.js @@ -0,0 +1,62 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("../dom/interfaces"); +var DOMException_1 = require("../dom/DOMException"); +/** + * Applies the filter to the given node and returns the result. + * + * @param traverser - the `NodeIterator` or `TreeWalker` instance + * @param node - the node to filter + */ +function traversal_filter(traverser, node) { + /** + * 1. If traverser’s active flag is set, then throw an "InvalidStateError" + * DOMException. + */ + if (traverser._activeFlag) { + throw new DOMException_1.InvalidStateError(); + } + /** + * 2. Let n be node’s nodeType attribute value − 1. + */ + var n = node._nodeType - 1; + /** + * 3. If the nth bit (where 0 is the least significant bit) of traverser’s + * whatToShow is not set, then return FILTER_SKIP. + */ + var mask = 1 << n; + if ((traverser.whatToShow & mask) === 0) { + return interfaces_1.FilterResult.Skip; + } + /** + * 4. If traverser’s filter is null, then return FILTER_ACCEPT. + */ + if (!traverser.filter) { + return interfaces_1.FilterResult.Accept; + } + /** + * 5. Set traverser’s active flag. + */ + traverser._activeFlag = true; + /** + * 6. Let result be the return value of call a user object’s operation with + * traverser’s filter, "acceptNode", and « node ». If this throws an + * exception, then unset traverser’s active flag and rethrow the exception. + */ + var result = interfaces_1.FilterResult.Reject; + try { + result = traverser.filter.acceptNode(node); + } + catch (err) { + traverser._activeFlag = false; + throw err; + } + /** + * 7. Unset traverser’s active flag. + * 8. Return result. + */ + traverser._activeFlag = false; + return result; +} +exports.traversal_filter = traversal_filter; +//# sourceMappingURL=TraversalAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/TraversalAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/TraversalAlgorithm.js.map new file mode 100644 index 0000000..62c345b --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/TraversalAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TraversalAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/TraversalAlgorithm.ts"],"names":[],"mappings":";;AAAA,gDAAgF;AAChF,oDAAuD;AAEvD;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,SAAoC,EACnE,IAAU;IACV;;;OAGG;IACH,IAAI,SAAS,CAAC,WAAW,EAAE;QACzB,MAAM,IAAI,gCAAiB,EAAE,CAAA;KAC9B;IAED;;OAEG;IACH,IAAM,CAAC,GAAG,IAAI,CAAC,SAAS,GAAG,CAAC,CAAA;IAE5B;;;OAGG;IACH,IAAM,IAAI,GAAG,CAAC,IAAI,CAAC,CAAA;IACnB,IAAI,CAAC,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE;QACvC,OAAO,yBAAY,CAAC,IAAI,CAAA;KACzB;IAED;;OAEG;IACH,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;QACrB,OAAO,yBAAY,CAAC,MAAM,CAAA;KAC3B;IAED;;OAEG;IACH,SAAS,CAAC,WAAW,GAAG,IAAI,CAAA;IAE5B;;;;OAIG;IACH,IAAI,MAAM,GAAG,yBAAY,CAAC,MAAM,CAAA;IAChC,IAAI;QACF,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;KAC3C;IAAC,OAAO,GAAG,EAAE;QACZ,SAAS,CAAC,WAAW,GAAG,KAAK,CAAA;QAC7B,MAAM,GAAG,CAAA;KACV;IAED;;;OAGG;IACH,SAAS,CAAC,WAAW,GAAG,KAAK,CAAA;IAC7B,OAAO,MAAM,CAAA;AACf,CAAC;AAvDD,4CAuDC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/TreeAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/TreeAlgorithm.d.ts new file mode 100644 index 0000000..9f2b8d3 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/TreeAlgorithm.d.ts @@ -0,0 +1,268 @@ +import { Element, Node } from "../dom/interfaces"; +/** + * Returns the first descendant node of the tree rooted at `node` in + * depth-first pre-order. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param shadow - whether to visit shadow tree nodes + * @param filter - a function to filter nodes + */ +export declare function tree_getFirstDescendantNode(node: Node, self?: boolean, shadow?: boolean, filter?: ((childNode: Node) => boolean)): Node | null; +/** + * Returns the next descendant node of the tree rooted at `node` in + * depth-first pre-order. + * + * @param node - root node of the tree + * @param currentNode - current descendant node + * @param self - whether to include `node` in traversal + * @param shadow - whether to visit shadow tree nodes + * @param filter - a function to filter nodes + */ +export declare function tree_getNextDescendantNode(node: Node, currentNode: Node, self?: boolean, shadow?: boolean, filter?: ((childNode: Node) => boolean)): Node | null; +/** + * Traverses through all descendant nodes of the tree rooted at + * `node` in depth-first pre-order. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param shadow - whether to visit shadow tree nodes + * @param filter - a function to filter nodes + */ +export declare function tree_getDescendantNodes(node: Node, self?: boolean, shadow?: boolean, filter?: ((childNode: Node) => boolean)): Iterable; +/** + * Traverses through all descendant element nodes of the tree rooted at + * `node` in depth-first preorder. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param shadow - whether to visit shadow tree nodes + * @param filter - a function to filter nodes + */ +export declare function tree_getDescendantElements(node: Node, self?: boolean, shadow?: boolean, filter?: ((childNode: Element) => boolean)): Iterable; +/** + * Traverses through all sibling nodes of `node`. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param filter - a function to filter nodes + */ +export declare function tree_getSiblingNodes(node: Node, self?: boolean, filter?: ((childNode: Node) => boolean)): Iterable; +/** + * Gets the first ancestor of `node` in reverse tree order. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param filter - a function to filter nodes + */ +export declare function tree_getFirstAncestorNode(node: Node, self?: boolean, filter?: ((ancestorNode: Node) => boolean)): Node | null; +/** + * Gets the first ancestor of `node` in reverse tree order. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param filter - a function to filter nodes + */ +export declare function tree_getNextAncestorNode(node: Node, currentNode: Node, self?: boolean, filter?: ((ancestorNode: Node) => boolean)): Node | null; +/** + * Traverses through all ancestor nodes `node` in reverse tree order. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param filter - a function to filter nodes + */ +export declare function tree_getAncestorNodes(node: Node, self?: boolean, filter?: ((ancestorNode: Node) => boolean)): Iterable; +/** + * Returns the common ancestor of the given nodes. + * + * @param nodeA - a node + * @param nodeB - a node + */ +export declare function tree_getCommonAncestor(nodeA: Node, nodeB: Node): Node | null; +/** + * Returns the node following `node` in depth-first preorder. + * + * @param root - root of the subtree + * @param node - a node + */ +export declare function tree_getFollowingNode(root: Node, node: Node): Node | null; +/** + * Returns the node preceding `node` in depth-first preorder. + * + * @param root - root of the subtree + * @param node - a node + */ +export declare function tree_getPrecedingNode(root: Node, node: Node): Node | null; +/** + * Determines if the node tree is constrained. A node tree is + * constrained as follows, expressed as a relationship between the + * type of node and its allowed children: + * - Document (In tree order) + * * Zero or more nodes each of which is ProcessingInstruction + * or Comment. + * * Optionally one DocumentType node. + * * Zero or more nodes each of which is ProcessingInstruction + * or Comment. + * * Optionally one Element node. + * * Zero or more nodes each of which is ProcessingInstruction + * or Comment. + * - DocumentFragment, Element + * * Zero or more nodes each of which is Element, Text, + * ProcessingInstruction, or Comment. + * - DocumentType, Text, ProcessingInstruction, Comment + * * None. + * + * @param node - the root of the tree + */ +export declare function tree_isConstrained(node: Node): boolean; +/** + * Returns the length of a node. + * + * @param node - a node to check + */ +export declare function tree_nodeLength(node: Node): number; +/** + * Determines if a node is empty. + * + * @param node - a node to check + */ +export declare function tree_isEmpty(node: Node): boolean; +/** + * Returns the root node of a tree. The root of an object is itself, + * if its parent is `null`, or else it is the root of its parent. + * The root of a tree is any object participating in that tree + * whose parent is `null`. + * + * @param node - a node of the tree + * @param shadow - `true` to return shadow-including root, otherwise + * `false` + */ +export declare function tree_rootNode(node: Node, shadow?: boolean): Node; +/** + * Determines whether `other` is a descendant of `node`. An object + * A is called a descendant of an object B, if either A is a child + * of B or A is a child of an object C that is a descendant of B. + * + * @param node - a node + * @param other - the node to check + * @param self - if `true`, traversal includes `node` itself + * @param shadow - if `true`, traversal includes the + * node's and its descendant's shadow trees as well. + */ +export declare function tree_isDescendantOf(node: Node, other: Node, self?: boolean, shadow?: boolean): boolean; +/** + * Determines whether `other` is an ancestor of `node`. An object A + * is called an ancestor of an object B if and only if B is a + * descendant of A. + * + * @param node - a node + * @param other - the node to check + * @param self - if `true`, traversal includes `node` itself + * @param shadow - if `true`, traversal includes the + * node's and its descendant's shadow trees as well. + */ +export declare function tree_isAncestorOf(node: Node, other: Node, self?: boolean, shadow?: boolean): boolean; +/** + * Determines whether `other` is a host-including ancestor of `node`. An + * object A is a host-including inclusive ancestor of an object B, if either + * A is an inclusive ancestor of B, or if B’s root has a non-null host and + * A is a host-including inclusive ancestor of B’s root’s host. + * + * @param node - a node + * @param other - the node to check + * @param self - if `true`, traversal includes `node` itself + */ +export declare function tree_isHostIncludingAncestorOf(node: Node, other: Node, self?: boolean): boolean; +/** + * Determines whether `other` is a sibling of `node`. An object A is + * called a sibling of an object B, if and only if B and A share + * the same non-null parent. + * + * @param node - a node + * @param other - the node to check + * @param self - if `true`, traversal includes `node` itself + */ +export declare function tree_isSiblingOf(node: Node, other: Node, self?: boolean): boolean; +/** + * Determines whether `other` is preceding `node`. An object A is + * preceding an object B if A and B are in the same tree and A comes + * before B in tree order. + * + * @param node - a node + * @param other - the node to check + */ +export declare function tree_isPreceding(node: Node, other: Node): boolean; +/** + * Determines whether `other` is following `node`. An object A is + * following an object B if A and B are in the same tree and A comes + * after B in tree order. + * + * @param node - a node + * @param other - the node to check + */ +export declare function tree_isFollowing(node: Node, other: Node): boolean; +/** + * Determines whether `other` is the parent node of `node`. + * + * @param node - a node + * @param other - the node to check + */ +export declare function tree_isParentOf(node: Node, other: Node): boolean; +/** + * Determines whether `other` is a child node of `node`. + * + * @param node - a node + * @param other - the node to check + */ +export declare function tree_isChildOf(node: Node, other: Node): boolean; +/** + * Returns the previous sibling node of `node` or null if it has no + * preceding sibling. + * + * @param node + */ +export declare function tree_previousSibling(node: Node): Node | null; +/** + * Returns the next sibling node of `node` or null if it has no + * following sibling. + * + * @param node + */ +export declare function tree_nextSibling(node: Node): Node | null; +/** + * Returns the first child node of `node` or null if it has no + * children. + * + * @param node + */ +export declare function tree_firstChild(node: Node): Node | null; +/** + * Returns the last child node of `node` or null if it has no + * children. + * + * @param node + */ +export declare function tree_lastChild(node: Node): Node | null; +/** + * Returns the zero-based index of `node` when counted preorder in + * the tree rooted at `root`. Returns `-1` if `node` is not in + * the tree. + * + * @param node - the node to get the index of + */ +export declare function tree_treePosition(node: Node): number; +/** + * Determines the index of `node`. The index of an object is its number of + * preceding siblings, or 0 if it has none. + * + * @param node - a node + * @param other - the node to check + */ +export declare function tree_index(node: Node): number; +/** + * Retargets an object against another object. + * + * @param a - an object to retarget + * @param b - an object to retarget against + */ +export declare function tree_retarget(a: any, b: any): any; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/TreeAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/TreeAlgorithm.js new file mode 100644 index 0000000..0dd4b39 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/TreeAlgorithm.js @@ -0,0 +1,853 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var util_1 = require("../util"); +var interfaces_1 = require("../dom/interfaces"); +/** + * Gets the next descendant of the given node of the tree rooted at `root` + * in depth-first pre-order. + * + * @param root - root node of the tree + * @param node - a node + * @param shadow - whether to visit shadow tree nodes + */ +function _getNextDescendantNode(root, node, shadow) { + if (shadow === void 0) { shadow = false; } + // traverse shadow tree + if (shadow && util_1.Guard.isElementNode(node) && util_1.Guard.isShadowRoot(node.shadowRoot)) { + if (node.shadowRoot._firstChild) + return node.shadowRoot._firstChild; + } + // traverse child nodes + if (node._firstChild) + return node._firstChild; + if (node === root) + return null; + // traverse siblings + if (node._nextSibling) + return node._nextSibling; + // traverse parent's next sibling + var parent = node._parent; + while (parent && parent !== root) { + if (parent._nextSibling) + return parent._nextSibling; + parent = parent._parent; + } + return null; +} +function _emptyIterator() { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + return { + next: function () { + return { done: true, value: null }; + } + }; + }, + _a; +} +/** + * Returns the first descendant node of the tree rooted at `node` in + * depth-first pre-order. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param shadow - whether to visit shadow tree nodes + * @param filter - a function to filter nodes + */ +function tree_getFirstDescendantNode(node, self, shadow, filter) { + if (self === void 0) { self = false; } + if (shadow === void 0) { shadow = false; } + var firstNode = (self ? node : _getNextDescendantNode(node, node, shadow)); + while (firstNode && filter && !filter(firstNode)) { + firstNode = _getNextDescendantNode(node, firstNode, shadow); + } + return firstNode; +} +exports.tree_getFirstDescendantNode = tree_getFirstDescendantNode; +/** + * Returns the next descendant node of the tree rooted at `node` in + * depth-first pre-order. + * + * @param node - root node of the tree + * @param currentNode - current descendant node + * @param self - whether to include `node` in traversal + * @param shadow - whether to visit shadow tree nodes + * @param filter - a function to filter nodes + */ +function tree_getNextDescendantNode(node, currentNode, self, shadow, filter) { + if (self === void 0) { self = false; } + if (shadow === void 0) { shadow = false; } + var nextNode = _getNextDescendantNode(node, currentNode, shadow); + while (nextNode && filter && !filter(nextNode)) { + nextNode = _getNextDescendantNode(node, nextNode, shadow); + } + return nextNode; +} +exports.tree_getNextDescendantNode = tree_getNextDescendantNode; +/** + * Traverses through all descendant nodes of the tree rooted at + * `node` in depth-first pre-order. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param shadow - whether to visit shadow tree nodes + * @param filter - a function to filter nodes + */ +function tree_getDescendantNodes(node, self, shadow, filter) { + var _a; + if (self === void 0) { self = false; } + if (shadow === void 0) { shadow = false; } + if (!self && node._children.size === 0) { + return _emptyIterator(); + } + return _a = {}, + _a[Symbol.iterator] = function () { + var currentNode = (self ? node : _getNextDescendantNode(node, node, shadow)); + return { + next: function () { + while (currentNode && filter && !filter(currentNode)) { + currentNode = _getNextDescendantNode(node, currentNode, shadow); + } + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + currentNode = _getNextDescendantNode(node, currentNode, shadow); + return result; + } + } + }; + }, + _a; +} +exports.tree_getDescendantNodes = tree_getDescendantNodes; +/** + * Traverses through all descendant element nodes of the tree rooted at + * `node` in depth-first preorder. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param shadow - whether to visit shadow tree nodes + * @param filter - a function to filter nodes + */ +function tree_getDescendantElements(node, self, shadow, filter) { + var _a; + if (self === void 0) { self = false; } + if (shadow === void 0) { shadow = false; } + if (!self && node._children.size === 0) { + return _emptyIterator(); + } + return _a = {}, + _a[Symbol.iterator] = function () { + var it = tree_getDescendantNodes(node, self, shadow, function (e) { return util_1.Guard.isElementNode(e); })[Symbol.iterator](); + var currentNode = it.next().value; + return { + next: function () { + while (currentNode && filter && !filter(currentNode)) { + currentNode = it.next().value; + } + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + currentNode = it.next().value; + return result; + } + } + }; + }, + _a; +} +exports.tree_getDescendantElements = tree_getDescendantElements; +/** + * Traverses through all sibling nodes of `node`. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param filter - a function to filter nodes + */ +function tree_getSiblingNodes(node, self, filter) { + var _a; + if (self === void 0) { self = false; } + if (!node._parent || node._parent._children.size === 0) { + return _emptyIterator(); + } + return _a = {}, + _a[Symbol.iterator] = function () { + var currentNode = node._parent ? node._parent._firstChild : null; + return { + next: function () { + while (currentNode && (filter && !filter(currentNode) || (!self && currentNode === node))) { + currentNode = currentNode._nextSibling; + } + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + currentNode = currentNode._nextSibling; + return result; + } + } + }; + }, + _a; +} +exports.tree_getSiblingNodes = tree_getSiblingNodes; +/** + * Gets the first ancestor of `node` in reverse tree order. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param filter - a function to filter nodes + */ +function tree_getFirstAncestorNode(node, self, filter) { + if (self === void 0) { self = false; } + var firstNode = self ? node : node._parent; + while (firstNode && filter && !filter(firstNode)) { + firstNode = firstNode._parent; + } + return firstNode; +} +exports.tree_getFirstAncestorNode = tree_getFirstAncestorNode; +/** + * Gets the first ancestor of `node` in reverse tree order. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param filter - a function to filter nodes + */ +function tree_getNextAncestorNode(node, currentNode, self, filter) { + if (self === void 0) { self = false; } + var nextNode = currentNode._parent; + while (nextNode && filter && !filter(nextNode)) { + nextNode = nextNode._parent; + } + return nextNode; +} +exports.tree_getNextAncestorNode = tree_getNextAncestorNode; +/** + * Traverses through all ancestor nodes `node` in reverse tree order. + * + * @param node - root node of the tree + * @param self - whether to include `node` in traversal + * @param filter - a function to filter nodes + */ +function tree_getAncestorNodes(node, self, filter) { + var _a; + if (self === void 0) { self = false; } + if (!self && !node._parent) { + return _emptyIterator(); + } + return _a = {}, + _a[Symbol.iterator] = function () { + var currentNode = tree_getFirstAncestorNode(node, self, filter); + return { + next: function () { + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + currentNode = tree_getNextAncestorNode(node, currentNode, self, filter); + return result; + } + } + }; + }, + _a; +} +exports.tree_getAncestorNodes = tree_getAncestorNodes; +/** + * Returns the common ancestor of the given nodes. + * + * @param nodeA - a node + * @param nodeB - a node + */ +function tree_getCommonAncestor(nodeA, nodeB) { + if (nodeA === nodeB) { + return nodeA._parent; + } + // lists of parent nodes + var parentsA = []; + var parentsB = []; + var pA = tree_getFirstAncestorNode(nodeA, true); + while (pA !== null) { + parentsA.push(pA); + pA = tree_getNextAncestorNode(nodeA, pA, true); + } + var pB = tree_getFirstAncestorNode(nodeB, true); + while (pB !== null) { + parentsB.push(pB); + pB = tree_getNextAncestorNode(nodeB, pB, true); + } + // walk through parents backwards until they differ + var pos1 = parentsA.length; + var pos2 = parentsB.length; + var parent = null; + for (var i = Math.min(pos1, pos2); i > 0; i--) { + var parent1 = parentsA[--pos1]; + var parent2 = parentsB[--pos2]; + if (parent1 !== parent2) { + break; + } + parent = parent1; + } + return parent; +} +exports.tree_getCommonAncestor = tree_getCommonAncestor; +/** + * Returns the node following `node` in depth-first preorder. + * + * @param root - root of the subtree + * @param node - a node + */ +function tree_getFollowingNode(root, node) { + if (node._firstChild) { + return node._firstChild; + } + else if (node._nextSibling) { + return node._nextSibling; + } + else { + while (true) { + var parent = node._parent; + if (parent === null || parent === root) { + return null; + } + else if (parent._nextSibling) { + return parent._nextSibling; + } + else { + node = parent; + } + } + } +} +exports.tree_getFollowingNode = tree_getFollowingNode; +/** + * Returns the node preceding `node` in depth-first preorder. + * + * @param root - root of the subtree + * @param node - a node + */ +function tree_getPrecedingNode(root, node) { + if (node === root) { + return null; + } + if (node._previousSibling) { + node = node._previousSibling; + if (node._lastChild) { + return node._lastChild; + } + else { + return node; + } + } + else { + return node._parent; + } +} +exports.tree_getPrecedingNode = tree_getPrecedingNode; +/** + * Determines if the node tree is constrained. A node tree is + * constrained as follows, expressed as a relationship between the + * type of node and its allowed children: + * - Document (In tree order) + * * Zero or more nodes each of which is ProcessingInstruction + * or Comment. + * * Optionally one DocumentType node. + * * Zero or more nodes each of which is ProcessingInstruction + * or Comment. + * * Optionally one Element node. + * * Zero or more nodes each of which is ProcessingInstruction + * or Comment. + * - DocumentFragment, Element + * * Zero or more nodes each of which is Element, Text, + * ProcessingInstruction, or Comment. + * - DocumentType, Text, ProcessingInstruction, Comment + * * None. + * + * @param node - the root of the tree + */ +function tree_isConstrained(node) { + var e_1, _a, e_2, _b, e_3, _c; + switch (node._nodeType) { + case interfaces_1.NodeType.Document: + var hasDocType = false; + var hasElement = false; + try { + for (var _d = __values(node._children), _e = _d.next(); !_e.done; _e = _d.next()) { + var childNode = _e.value; + switch (childNode._nodeType) { + case interfaces_1.NodeType.ProcessingInstruction: + case interfaces_1.NodeType.Comment: + break; + case interfaces_1.NodeType.DocumentType: + if (hasDocType || hasElement) + return false; + hasDocType = true; + break; + case interfaces_1.NodeType.Element: + if (hasElement) + return false; + hasElement = true; + break; + default: + return false; + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_e && !_e.done && (_a = _d.return)) _a.call(_d); + } + finally { if (e_1) throw e_1.error; } + } + break; + case interfaces_1.NodeType.DocumentFragment: + case interfaces_1.NodeType.Element: + try { + for (var _f = __values(node._children), _g = _f.next(); !_g.done; _g = _f.next()) { + var childNode = _g.value; + switch (childNode._nodeType) { + case interfaces_1.NodeType.Element: + case interfaces_1.NodeType.Text: + case interfaces_1.NodeType.ProcessingInstruction: + case interfaces_1.NodeType.CData: + case interfaces_1.NodeType.Comment: + break; + default: + return false; + } + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_g && !_g.done && (_b = _f.return)) _b.call(_f); + } + finally { if (e_2) throw e_2.error; } + } + break; + case interfaces_1.NodeType.DocumentType: + case interfaces_1.NodeType.Text: + case interfaces_1.NodeType.ProcessingInstruction: + case interfaces_1.NodeType.CData: + case interfaces_1.NodeType.Comment: + return (!node.hasChildNodes()); + } + try { + for (var _h = __values(node._children), _j = _h.next(); !_j.done; _j = _h.next()) { + var childNode = _j.value; + // recursively check child nodes + if (!tree_isConstrained(childNode)) + return false; + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (_j && !_j.done && (_c = _h.return)) _c.call(_h); + } + finally { if (e_3) throw e_3.error; } + } + return true; +} +exports.tree_isConstrained = tree_isConstrained; +/** + * Returns the length of a node. + * + * @param node - a node to check + */ +function tree_nodeLength(node) { + /** + * To determine the length of a node node, switch on node: + * - DocumentType + * Zero. + * - Text + * - ProcessingInstruction + * - Comment + * Its data’s length. + * - Any other node + * Its number of children. + */ + if (util_1.Guard.isDocumentTypeNode(node)) { + return 0; + } + else if (util_1.Guard.isCharacterDataNode(node)) { + return node._data.length; + } + else { + return node._children.size; + } +} +exports.tree_nodeLength = tree_nodeLength; +/** + * Determines if a node is empty. + * + * @param node - a node to check + */ +function tree_isEmpty(node) { + /** + * A node is considered empty if its length is zero. + */ + return (tree_nodeLength(node) === 0); +} +exports.tree_isEmpty = tree_isEmpty; +/** + * Returns the root node of a tree. The root of an object is itself, + * if its parent is `null`, or else it is the root of its parent. + * The root of a tree is any object participating in that tree + * whose parent is `null`. + * + * @param node - a node of the tree + * @param shadow - `true` to return shadow-including root, otherwise + * `false` + */ +function tree_rootNode(node, shadow) { + if (shadow === void 0) { shadow = false; } + /** + * The root of an object is itself, if its parent is null, or else it is the + * root of its parent. The root of a tree is any object participating in + * that tree whose parent is null. + */ + if (shadow) { + var root = tree_rootNode(node, false); + if (util_1.Guard.isShadowRoot(root)) + return tree_rootNode(root._host, true); + else + return root; + } + else { + if (!node._parent) + return node; + else + return tree_rootNode(node._parent); + } +} +exports.tree_rootNode = tree_rootNode; +/** + * Determines whether `other` is a descendant of `node`. An object + * A is called a descendant of an object B, if either A is a child + * of B or A is a child of an object C that is a descendant of B. + * + * @param node - a node + * @param other - the node to check + * @param self - if `true`, traversal includes `node` itself + * @param shadow - if `true`, traversal includes the + * node's and its descendant's shadow trees as well. + */ +function tree_isDescendantOf(node, other, self, shadow) { + if (self === void 0) { self = false; } + if (shadow === void 0) { shadow = false; } + /** + * An object A is called a descendant of an object B, if either A is a + * child of B or A is a child of an object C that is a descendant of B. + * + * An inclusive descendant is an object or one of its descendants. + */ + var child = tree_getFirstDescendantNode(node, self, shadow); + while (child !== null) { + if (child === other) { + return true; + } + child = tree_getNextDescendantNode(node, child, self, shadow); + } + return false; +} +exports.tree_isDescendantOf = tree_isDescendantOf; +/** + * Determines whether `other` is an ancestor of `node`. An object A + * is called an ancestor of an object B if and only if B is a + * descendant of A. + * + * @param node - a node + * @param other - the node to check + * @param self - if `true`, traversal includes `node` itself + * @param shadow - if `true`, traversal includes the + * node's and its descendant's shadow trees as well. + */ +function tree_isAncestorOf(node, other, self, shadow) { + if (self === void 0) { self = false; } + if (shadow === void 0) { shadow = false; } + var ancestor = self ? node : shadow && util_1.Guard.isShadowRoot(node) ? + node._host : node._parent; + while (ancestor !== null) { + if (ancestor === other) + return true; + ancestor = shadow && util_1.Guard.isShadowRoot(ancestor) ? + ancestor._host : ancestor._parent; + } + return false; +} +exports.tree_isAncestorOf = tree_isAncestorOf; +/** + * Determines whether `other` is a host-including ancestor of `node`. An + * object A is a host-including inclusive ancestor of an object B, if either + * A is an inclusive ancestor of B, or if B’s root has a non-null host and + * A is a host-including inclusive ancestor of B’s root’s host. + * + * @param node - a node + * @param other - the node to check + * @param self - if `true`, traversal includes `node` itself + */ +function tree_isHostIncludingAncestorOf(node, other, self) { + if (self === void 0) { self = false; } + if (tree_isAncestorOf(node, other, self)) + return true; + var root = tree_rootNode(node); + if (util_1.Guard.isDocumentFragmentNode(root) && root._host !== null && + tree_isHostIncludingAncestorOf(root._host, other, self)) + return true; + return false; +} +exports.tree_isHostIncludingAncestorOf = tree_isHostIncludingAncestorOf; +/** + * Determines whether `other` is a sibling of `node`. An object A is + * called a sibling of an object B, if and only if B and A share + * the same non-null parent. + * + * @param node - a node + * @param other - the node to check + * @param self - if `true`, traversal includes `node` itself + */ +function tree_isSiblingOf(node, other, self) { + if (self === void 0) { self = false; } + /** + * An object A is called a sibling of an object B, if and only if B and A + * share the same non-null parent. + * + * An inclusive sibling is an object or one of its siblings. + */ + if (node === other) { + if (self) + return true; + } + else { + return (node._parent !== null && node._parent === other._parent); + } + return false; +} +exports.tree_isSiblingOf = tree_isSiblingOf; +/** + * Determines whether `other` is preceding `node`. An object A is + * preceding an object B if A and B are in the same tree and A comes + * before B in tree order. + * + * @param node - a node + * @param other - the node to check + */ +function tree_isPreceding(node, other) { + /** + * An object A is preceding an object B if A and B are in the same tree and + * A comes before B in tree order. + */ + var nodePos = tree_treePosition(node); + var otherPos = tree_treePosition(other); + if (nodePos === -1 || otherPos === -1) + return false; + else if (tree_rootNode(node) !== tree_rootNode(other)) + return false; + else + return otherPos < nodePos; +} +exports.tree_isPreceding = tree_isPreceding; +/** + * Determines whether `other` is following `node`. An object A is + * following an object B if A and B are in the same tree and A comes + * after B in tree order. + * + * @param node - a node + * @param other - the node to check + */ +function tree_isFollowing(node, other) { + /** + * An object A is following an object B if A and B are in the same tree and + * A comes after B in tree order. + */ + var nodePos = tree_treePosition(node); + var otherPos = tree_treePosition(other); + if (nodePos === -1 || otherPos === -1) + return false; + else if (tree_rootNode(node) !== tree_rootNode(other)) + return false; + else + return otherPos > nodePos; +} +exports.tree_isFollowing = tree_isFollowing; +/** + * Determines whether `other` is the parent node of `node`. + * + * @param node - a node + * @param other - the node to check + */ +function tree_isParentOf(node, other) { + /** + * An object that participates in a tree has a parent, which is either + * null or an object, and has children, which is an ordered set of objects. + * An object A whose parent is object B is a child of B. + */ + return (node._parent === other); +} +exports.tree_isParentOf = tree_isParentOf; +/** + * Determines whether `other` is a child node of `node`. + * + * @param node - a node + * @param other - the node to check + */ +function tree_isChildOf(node, other) { + /** + * An object that participates in a tree has a parent, which is either + * null or an object, and has children, which is an ordered set of objects. + * An object A whose parent is object B is a child of B. + */ + return (other._parent === node); +} +exports.tree_isChildOf = tree_isChildOf; +/** + * Returns the previous sibling node of `node` or null if it has no + * preceding sibling. + * + * @param node + */ +function tree_previousSibling(node) { + /** + * The previous sibling of an object is its first preceding sibling or null + * if it has no preceding sibling. + */ + return node._previousSibling; +} +exports.tree_previousSibling = tree_previousSibling; +/** + * Returns the next sibling node of `node` or null if it has no + * following sibling. + * + * @param node + */ +function tree_nextSibling(node) { + /** + * The next sibling of an object is its first following sibling or null + * if it has no following sibling. + */ + return node._nextSibling; +} +exports.tree_nextSibling = tree_nextSibling; +/** + * Returns the first child node of `node` or null if it has no + * children. + * + * @param node + */ +function tree_firstChild(node) { + /** + * The first child of an object is its first child or null if it has no + * children. + */ + return node._firstChild; +} +exports.tree_firstChild = tree_firstChild; +/** + * Returns the last child node of `node` or null if it has no + * children. + * + * @param node + */ +function tree_lastChild(node) { + /** + * The last child of an object is its last child or null if it has no + * children. + */ + return node._lastChild; +} +exports.tree_lastChild = tree_lastChild; +/** + * Returns the zero-based index of `node` when counted preorder in + * the tree rooted at `root`. Returns `-1` if `node` is not in + * the tree. + * + * @param node - the node to get the index of + */ +function tree_treePosition(node) { + var root = tree_rootNode(node); + var pos = 0; + var childNode = tree_getFirstDescendantNode(root); + while (childNode !== null) { + pos++; + if (childNode === node) + return pos; + childNode = tree_getNextDescendantNode(root, childNode); + } + return -1; +} +exports.tree_treePosition = tree_treePosition; +/** + * Determines the index of `node`. The index of an object is its number of + * preceding siblings, or 0 if it has none. + * + * @param node - a node + * @param other - the node to check + */ +function tree_index(node) { + /** + * The index of an object is its number of preceding siblings, or 0 if it + * has none. + */ + var n = 0; + while (node._previousSibling !== null) { + n++; + node = node._previousSibling; + } + return n; +} +exports.tree_index = tree_index; +/** + * Retargets an object against another object. + * + * @param a - an object to retarget + * @param b - an object to retarget against + */ +function tree_retarget(a, b) { + /** + * To retarget an object A against an object B, repeat these steps until + * they return an object: + * 1. If one of the following is true + * - A is not a node + * - A's root is not a shadow root + * - B is a node and A's root is a shadow-including inclusive ancestor + * of B + * then return A. + * 2. Set A to A's root's host. + */ + while (true) { + if (!a || !util_1.Guard.isNode(a)) { + return a; + } + var rootOfA = tree_rootNode(a); + if (!util_1.Guard.isShadowRoot(rootOfA)) { + return a; + } + if (b && util_1.Guard.isNode(b) && tree_isAncestorOf(rootOfA, b, true, true)) { + return a; + } + a = rootOfA.host; + } +} +exports.tree_retarget = tree_retarget; +//# sourceMappingURL=TreeAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/TreeAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/TreeAlgorithm.js.map new file mode 100644 index 0000000..1696a50 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/TreeAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TreeAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/TreeAlgorithm.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,gCAA+B;AAC/B,gDAA2D;AAE3D;;;;;;;GAOG;AACH,SAAS,sBAAsB,CAAC,IAAU,EAAE,IAAU,EAAE,MAAuB;IAAvB,uBAAA,EAAA,cAAuB;IAC7E,uBAAuB;IACvB,IAAI,MAAM,IAAI,YAAK,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,YAAK,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;QAC9E,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAA;KACpE;IAED,uBAAuB;IACvB,IAAI,IAAI,CA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BC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/TreeWalkerAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/TreeWalkerAlgorithm.d.ts new file mode 100644 index 0000000..212e5a9 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/TreeWalkerAlgorithm.d.ts @@ -0,0 +1,17 @@ +import { TreeWalker, Node } from "../dom/interfaces"; +/** + * Returns the first or last child node, or `null` if there are none. + * + * @param walker - the `TreeWalker` instance + * @param first - `true` to return the first child node, or `false` to + * return the last child node. + */ +export declare function treeWalker_traverseChildren(walker: TreeWalker, first: boolean): Node | null; +/** + * Returns the next or previous sibling node, or `null` if there are none. + * + * @param walker - the `TreeWalker` instance + * @param next - `true` to return the next sibling node, or `false` to + * return the previous sibling node. + */ +export declare function treeWalker_traverseSiblings(walker: TreeWalker, next: boolean): Node | null; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/TreeWalkerAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/TreeWalkerAlgorithm.js new file mode 100644 index 0000000..ec275d6 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/TreeWalkerAlgorithm.js @@ -0,0 +1,147 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("../dom/interfaces"); +var TraversalAlgorithm_1 = require("./TraversalAlgorithm"); +/** + * Returns the first or last child node, or `null` if there are none. + * + * @param walker - the `TreeWalker` instance + * @param first - `true` to return the first child node, or `false` to + * return the last child node. + */ +function treeWalker_traverseChildren(walker, first) { + /** + * 1. Let node be walker’s current. + * 2. Set node to node’s first child if type is first, and node’s last child + * if type is last. + * 3. While node is non-null: + */ + var node = (first ? walker._current._firstChild : walker._current._lastChild); + while (node !== null) { + /** + * 3.1. Let result be the result of filtering node within walker. + */ + var result = TraversalAlgorithm_1.traversal_filter(walker, node); + if (result === interfaces_1.FilterResult.Accept) { + /** + * 3.2. If result is FILTER_ACCEPT, then set walker’s current to node and + * return node. + */ + walker._current = node; + return node; + } + else if (result === interfaces_1.FilterResult.Skip) { + /** + * 3.3. If result is FILTER_SKIP, then: + * 3.3.1. Let child be node’s first child if type is first, and node’s + * last child if type is last. + * 3.3.2. If child is non-null, then set node to child and continue. + */ + var child = (first ? node._firstChild : node._lastChild); + if (child !== null) { + node = child; + continue; + } + } + /** + * 3.4. While node is non-null: + */ + while (node !== null) { + /** + * 3.4.1. Let sibling be node’s next sibling if type is first, and + * node’s previous sibling if type is last. + * 3.4.2. If sibling is non-null, then set node to sibling and break. + */ + var sibling = (first ? node._nextSibling : node._previousSibling); + if (sibling !== null) { + node = sibling; + break; + } + /** + * 3.4.3. Let parent be node’s parent. + * 3.4.4. If parent is null, walker’s root, or walker’s current, then + * return null. + */ + var parent = node._parent; + if (parent === null || parent === walker._root || parent === walker._current) { + return null; + } + /** + * 3.4.5. Set node to parent. + */ + node = parent; + } + } + /** + * 5. Return null + */ + return null; +} +exports.treeWalker_traverseChildren = treeWalker_traverseChildren; +/** + * Returns the next or previous sibling node, or `null` if there are none. + * + * @param walker - the `TreeWalker` instance + * @param next - `true` to return the next sibling node, or `false` to + * return the previous sibling node. + */ +function treeWalker_traverseSiblings(walker, next) { + /** + * 1. Let node be walker’s current. + * 2. If node is root, then return null. + * 3. While node is non-null: + */ + var node = walker._current; + if (node === walker._root) + return null; + while (true) { + /** + * 3.1. Let sibling be node’s next sibling if type is next, and node’s + * previous sibling if type is previous. + * 3.2. While sibling is non-null: + */ + var sibling = (next ? node._nextSibling : node._previousSibling); + while (sibling !== null) { + /** + * 3.2.1. Set node to sibling. + * 3.2.2. Let result be the result of filtering node within walker. + * 3.2.3. If result is FILTER_ACCEPT, then set walker’s current to node + * and return node. + */ + node = sibling; + var result = TraversalAlgorithm_1.traversal_filter(walker, node); + if (result === interfaces_1.FilterResult.Accept) { + walker._current = node; + return node; + } + /** + * 3.2.4. Set sibling to node’s first child if type is next, and node’s + * last child if type is previous. + * 3.2.5. If result is FILTER_REJECT or sibling is null, then set + * sibling to node’s next sibling if type is next, and node’s previous + * sibling if type is previous. + */ + sibling = (next ? node._firstChild : node._lastChild); + if (result === interfaces_1.FilterResult.Reject || sibling === null) { + sibling = (next ? node._nextSibling : node._previousSibling); + } + } + /** + * 3.3. Set node to node’s parent. + * 3.4. If node is null or walker’s root, then return null. + */ + node = node._parent; + if (node === null || node === walker._root) { + return null; + } + /** + * 3.5. If the return value of filtering node within walker is FILTER_ACCEPT, + * then return null. + */ + if (TraversalAlgorithm_1.traversal_filter(walker, node) === interfaces_1.FilterResult.Accept) { + return null; + } + } +} +exports.treeWalker_traverseSiblings = treeWalker_traverseSiblings; +//# sourceMappingURL=TreeWalkerAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/TreeWalkerAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/TreeWalkerAlgorithm.js.map new file mode 100644 index 0000000..bb5223d --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/TreeWalkerAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TreeWalkerAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/TreeWalkerAlgorithm.ts"],"names":[],"mappings":";;AAAA,gDAAkE;AAClE,2DAAuD;AAEvD;;;;;;GAMG;AACH,SAAgB,2BAA2B,CAAC,MAAkB,EAAE,KAAc;IAC5E;;;;;OAKG;IACH,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;IAC7E,OAAO,IAAI,KAAK,IAAI,EAAE;QACpB;;WAEG;QACH,IAAM,MAAM,GAAG,qCAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAE7C,IAAI,MAAM,KAAK,yBAAY,CAAC,MAAM,EAAE;YAClC;;;eAGG;YACH,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAA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AAgB,CAAC,CAAA;QAE7E,OAAO,OAAO,KAAK,IAAI,EAAE;YACvB;;;;;eAKG;YACH,IAAI,GAAG,OAAO,CAAA;YACd,IAAM,MAAM,GAAG,qCAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;YAC7C,IAAI,MAAM,KAAK,yBAAY,CAAC,MAAM,EAAE;gBAClC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAA;gBACtB,OAAO,IAAI,CAAA;aACZ;YAED;;;;;;eAMG;YACH,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;YACrD,IAAI,MAAM,KAAK,yBAAY,CAAC,MAAM,IAAI,OAAO,KAAK,IAAI,EAAE;gBACtD,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;aAC7D;SACF;QAED;;;WAGG;QACH,IAAI,GAAG,IAAI,CAAC,OAAO,CAAA;QACnB,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,MAAM,CAAC,KAAK,EAAE;YAC1C,OAAO,IAAI,CAAA;SACZ;QAED;;;WAGG;QACH,IAAI,qCAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,yBAAY,CAAC,MAAM,EAAE;YAC1D,OAAO,IAAI,CAAA;SACZ;KACF;AACH,CAAC;AA7DD,kEA6DC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/WebIDLAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/WebIDLAlgorithm.d.ts new file mode 100644 index 0000000..b7177ee --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/WebIDLAlgorithm.d.ts @@ -0,0 +1,8 @@ +/** + * Defines a WebIDL `Const` property on the given object. + * + * @param o - object on which to add the property + * @param name - property name + * @param value - property value + */ +export declare function idl_defineConst(o: any, name: string, value: string | number | boolean): void; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/WebIDLAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/WebIDLAlgorithm.js new file mode 100644 index 0000000..13f4add --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/WebIDLAlgorithm.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Defines a WebIDL `Const` property on the given object. + * + * @param o - object on which to add the property + * @param name - property name + * @param value - property value + */ +function idl_defineConst(o, name, value) { + Object.defineProperty(o, name, { writable: false, enumerable: true, configurable: false, value: value }); +} +exports.idl_defineConst = idl_defineConst; +//# sourceMappingURL=WebIDLAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/WebIDLAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/WebIDLAlgorithm.js.map new file mode 100644 index 0000000..7d46d9f --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/WebIDLAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"WebIDLAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/WebIDLAlgorithm.ts"],"names":[],"mappings":";;AAAA;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,CAAM,EAAE,IAAY,EAAE,KAAgC;IACpF,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,IAAI,EAC3B,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;AAC7E,CAAC;AAHD,0CAGC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/XMLAlgorithm.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/XMLAlgorithm.d.ts new file mode 100644 index 0000000..7fea4a7 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/XMLAlgorithm.d.ts @@ -0,0 +1,25 @@ +/** + * Determines if the given string is valid for a `"Name"` construct. + * + * @param name - name string to test + */ +export declare function xml_isName(name: string): boolean; +/** + * Determines if the given string is valid for a `"QName"` construct. + * + * @param name - name string to test + */ +export declare function xml_isQName(name: string): boolean; +/** + * Determines if the given string contains legal characters. + * + * @param chars - sequence of characters to test + */ +export declare function xml_isLegalChar(chars: string): boolean; +/** + * Determines if the given string contains legal characters for a public + * identifier. + * + * @param chars - sequence of characters to test + */ +export declare function xml_isPubidChar(chars: string): boolean; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/XMLAlgorithm.js b/node_modules/@oozcitak/dom/lib/algorithm/XMLAlgorithm.js new file mode 100644 index 0000000..c9405c3 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/XMLAlgorithm.js @@ -0,0 +1,164 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Determines if the given string is valid for a `"Name"` construct. + * + * @param name - name string to test + */ +function xml_isName(name) { + for (var i = 0; i < name.length; i++) { + var n = name.charCodeAt(i); + // NameStartChar + if ((n >= 97 && n <= 122) || // [a-z] + (n >= 65 && n <= 90) || // [A-Z] + n === 58 || n === 95 || // ':' or '_' + (n >= 0xC0 && n <= 0xD6) || + (n >= 0xD8 && n <= 0xF6) || + (n >= 0xF8 && n <= 0x2FF) || + (n >= 0x370 && n <= 0x37D) || + (n >= 0x37F && n <= 0x1FFF) || + (n >= 0x200C && n <= 0x200D) || + (n >= 0x2070 && n <= 0x218F) || + (n >= 0x2C00 && n <= 0x2FEF) || + (n >= 0x3001 && n <= 0xD7FF) || + (n >= 0xF900 && n <= 0xFDCF) || + (n >= 0xFDF0 && n <= 0xFFFD)) { + continue; + } + else if (i !== 0 && + (n === 45 || n === 46 || // '-' or '.' + (n >= 48 && n <= 57) || // [0-9] + (n === 0xB7) || + (n >= 0x0300 && n <= 0x036F) || + (n >= 0x203F && n <= 0x2040))) { + continue; + } + if (n >= 0xD800 && n <= 0xDBFF && i < name.length - 1) { + var n2 = name.charCodeAt(i + 1); + if (n2 >= 0xDC00 && n2 <= 0xDFFF) { + n = (n - 0xD800) * 0x400 + n2 - 0xDC00 + 0x10000; + i++; + if (n >= 0x10000 && n <= 0xEFFFF) { + continue; + } + } + } + return false; + } + return true; +} +exports.xml_isName = xml_isName; +/** + * Determines if the given string is valid for a `"QName"` construct. + * + * @param name - name string to test + */ +function xml_isQName(name) { + var colonFound = false; + for (var i = 0; i < name.length; i++) { + var n = name.charCodeAt(i); + // NameStartChar + if ((n >= 97 && n <= 122) || // [a-z] + (n >= 65 && n <= 90) || // [A-Z] + n === 95 || // '_' + (n >= 0xC0 && n <= 0xD6) || + (n >= 0xD8 && n <= 0xF6) || + (n >= 0xF8 && n <= 0x2FF) || + (n >= 0x370 && n <= 0x37D) || + (n >= 0x37F && n <= 0x1FFF) || + (n >= 0x200C && n <= 0x200D) || + (n >= 0x2070 && n <= 0x218F) || + (n >= 0x2C00 && n <= 0x2FEF) || + (n >= 0x3001 && n <= 0xD7FF) || + (n >= 0xF900 && n <= 0xFDCF) || + (n >= 0xFDF0 && n <= 0xFFFD)) { + continue; + } + else if (i !== 0 && + (n === 45 || n === 46 || // '-' or '.' + (n >= 48 && n <= 57) || // [0-9] + (n === 0xB7) || + (n >= 0x0300 && n <= 0x036F) || + (n >= 0x203F && n <= 0x2040))) { + continue; + } + else if (i !== 0 && n === 58) { // : + if (colonFound) + return false; // multiple colons in qname + if (i === name.length - 1) + return false; // colon at the end of qname + colonFound = true; + continue; + } + if (n >= 0xD800 && n <= 0xDBFF && i < name.length - 1) { + var n2 = name.charCodeAt(i + 1); + if (n2 >= 0xDC00 && n2 <= 0xDFFF) { + n = (n - 0xD800) * 0x400 + n2 - 0xDC00 + 0x10000; + i++; + if (n >= 0x10000 && n <= 0xEFFFF) { + continue; + } + } + } + return false; + } + return true; +} +exports.xml_isQName = xml_isQName; +/** + * Determines if the given string contains legal characters. + * + * @param chars - sequence of characters to test + */ +function xml_isLegalChar(chars) { + for (var i = 0; i < chars.length; i++) { + var n = chars.charCodeAt(i); + // #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] + if (n === 0x9 || n === 0xA || n === 0xD || + (n >= 0x20 && n <= 0xD7FF) || + (n >= 0xE000 && n <= 0xFFFD)) { + continue; + } + if (n >= 0xD800 && n <= 0xDBFF && i < chars.length - 1) { + var n2 = chars.charCodeAt(i + 1); + if (n2 >= 0xDC00 && n2 <= 0xDFFF) { + n = (n - 0xD800) * 0x400 + n2 - 0xDC00 + 0x10000; + i++; + if (n >= 0x10000 && n <= 0x10FFFF) { + continue; + } + } + } + return false; + } + return true; +} +exports.xml_isLegalChar = xml_isLegalChar; +/** + * Determines if the given string contains legal characters for a public + * identifier. + * + * @param chars - sequence of characters to test + */ +function xml_isPubidChar(chars) { + for (var i = 0; i < chars.length; i++) { + // PubId chars are all in the ASCII range, no need to check surrogates + var n = chars.charCodeAt(i); + // #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] + if ((n >= 97 && n <= 122) || // [a-z] + (n >= 65 && n <= 90) || // [A-Z] + (n >= 39 && n <= 59) || // ['()*+,-./] | [0-9] | [:;] + n === 0x20 || n === 0xD || n === 0xA || // #x20 | #xD | #xA + (n >= 35 && n <= 37) || // [#$%] + n === 33 || // ! + n === 61 || n === 63 || n === 64 || n === 95) { // [=?@_] + continue; + } + else { + return false; + } + } + return true; +} +exports.xml_isPubidChar = xml_isPubidChar; +//# sourceMappingURL=XMLAlgorithm.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/XMLAlgorithm.js.map b/node_modules/@oozcitak/dom/lib/algorithm/XMLAlgorithm.js.map new file mode 100644 index 0000000..046927e --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/XMLAlgorithm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"XMLAlgorithm.js","sourceRoot":"","sources":["../../src/algorithm/XMLAlgorith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;SACT;aAAM;YACL,OAAO,KAAK,CAAA;SACb;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AApBD,0CAoBC"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/index.d.ts b/node_modules/@oozcitak/dom/lib/algorithm/index.d.ts new file mode 100644 index 0000000..b966faa --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/index.d.ts @@ -0,0 +1,28 @@ +export * from "./AbortAlgorithm"; +export * from "./AttrAlgorithm"; +export * from "./BoundaryPointAlgorithm"; +export * from "./CharacterDataAlgorithm"; +export * from "./CreateAlgorithm"; +export * from "./CustomElementAlgorithm"; +export * from "./DocumentAlgorithm"; +export * from "./DOMAlgorithm"; +export * from "./DOMTokenListAlgorithm"; +export * from "./ElementAlgorithm"; +export * from "./EventAlgorithm"; +export * from "./EventTargetAlgorithm"; +export * from "./MutationAlgorithm"; +export * from "./MutationObserverAlgorithm"; +export * from "./NamespaceAlgorithm"; +export * from "./NodeAlgorithm"; +export * from "./NodeIteratorAlgorithm"; +export * from "./OrderedSetAlgorithm"; +export * from "./ParentNodeAlgorithm"; +export * from "./RangeAlgorithm"; +export * from "./SelectorsAlgorithm"; +export * from "./ShadowTreeAlgorithm"; +export * from "./TextAlgorithm"; +export * from "./TraversalAlgorithm"; +export * from "./TreeAlgorithm"; +export * from "./TreeWalkerAlgorithm"; +export * from "./WebIDLAlgorithm"; +export * from "./XMLAlgorithm"; diff --git a/node_modules/@oozcitak/dom/lib/algorithm/index.js b/node_modules/@oozcitak/dom/lib/algorithm/index.js new file mode 100644 index 0000000..6256d62 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/index.js @@ -0,0 +1,34 @@ +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", { value: true }); +__export(require("./AbortAlgorithm")); +__export(require("./AttrAlgorithm")); +__export(require("./BoundaryPointAlgorithm")); +__export(require("./CharacterDataAlgorithm")); +__export(require("./CreateAlgorithm")); +__export(require("./CustomElementAlgorithm")); +__export(require("./DocumentAlgorithm")); +__export(require("./DOMAlgorithm")); +__export(require("./DOMTokenListAlgorithm")); +__export(require("./ElementAlgorithm")); +__export(require("./EventAlgorithm")); +__export(require("./EventTargetAlgorithm")); +__export(require("./MutationAlgorithm")); +__export(require("./MutationObserverAlgorithm")); +__export(require("./NamespaceAlgorithm")); +__export(require("./NodeAlgorithm")); +__export(require("./NodeIteratorAlgorithm")); +__export(require("./OrderedSetAlgorithm")); +__export(require("./ParentNodeAlgorithm")); +__export(require("./RangeAlgorithm")); +__export(require("./SelectorsAlgorithm")); +__export(require("./ShadowTreeAlgorithm")); +__export(require("./TextAlgorithm")); +__export(require("./TraversalAlgorithm")); +__export(require("./TreeAlgorithm")); +__export(require("./TreeWalkerAlgorithm")); +__export(require("./WebIDLAlgorithm")); +__export(require("./XMLAlgorithm")); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/algorithm/index.js.map b/node_modules/@oozcitak/dom/lib/algorithm/index.js.map new file mode 100644 index 0000000..b1ad4fb --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/algorithm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/algorithm/index.ts"],"names":[],"mappings":";;;;;AAAA,sCAAgC;AAChC,qCAA+B;AAC/B,8CAAwC;AACxC,8CAAwC;AACxC,uCAAiC;AACjC,8CAAwC;AACxC,yCAAmC;AACnC,oCAA8B;AAC9B,6CAAuC;AACvC,wCAAkC;AAClC,sCAAgC;AAChC,4CAAsC;AACtC,yCAAmC;AACnC,iDAA2C;AAC3C,0CAAoC;AACpC,qCAA+B;AAC/B,6CAAuC;AACvC,2CAAqC;AACrC,2CAAqC;AACrC,sCAAgC;AAChC,0CAAoC;AACpC,2CAAqC;AACrC,qCAA+B;AAC/B,0CAAoC;AACpC,qCAA+B;AAC/B,2CAAqC;AACrC,uCAAiC;AACjC,oCAA8B"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/AbortControllerImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/AbortControllerImpl.d.ts new file mode 100644 index 0000000..2a80deb --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/AbortControllerImpl.d.ts @@ -0,0 +1,15 @@ +import { AbortSignal, AbortController } from "./interfaces"; +/** + * Represents a controller that allows to abort DOM requests. + */ +export declare class AbortControllerImpl implements AbortController { + _signal: AbortSignal; + /** + * Initializes a new instance of `AbortController`. + */ + constructor(); + /** @inheritdoc */ + get signal(): AbortSignal; + /** @inheritdoc */ + abort(): void; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/AbortControllerImpl.js b/node_modules/@oozcitak/dom/lib/dom/AbortControllerImpl.js new file mode 100644 index 0000000..7fab9b0 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/AbortControllerImpl.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var algorithm_1 = require("../algorithm"); +/** + * Represents a controller that allows to abort DOM requests. + */ +var AbortControllerImpl = /** @class */ (function () { + /** + * Initializes a new instance of `AbortController`. + */ + function AbortControllerImpl() { + /** + * 1. Let signal be a new AbortSignal object. + * 2. Let controller be a new AbortController object whose signal is signal. + * 3. Return controller. + */ + this._signal = algorithm_1.create_abortSignal(); + } + Object.defineProperty(AbortControllerImpl.prototype, "signal", { + /** @inheritdoc */ + get: function () { return this._signal; }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + AbortControllerImpl.prototype.abort = function () { + algorithm_1.abort_signalAbort(this._signal); + }; + return AbortControllerImpl; +}()); +exports.AbortControllerImpl = AbortControllerImpl; +//# sourceMappingURL=AbortControllerImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/AbortControllerImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/AbortControllerImpl.js.map new file mode 100644 index 0000000..d0f8cac --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/AbortControllerImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AbortControllerImpl.js","sourceRoot":"","sources":["../../src/dom/AbortControllerImpl.ts"],"names":[],"mappings":";;AACA,0CAAoE;AAEpE;;GAEG;AACH;IAIE;;OAEG;IACH;QACE;;;;WAIG;QACH,IAAI,CAAC,OAAO,GAAG,8BAAkB,EAAE,CAAA;IACrC,CAAC;IAGD,sBAAI,uCAAM;QADV,kBAAkB;aAClB,cAA4B,OAAO,IAAI,CAAC,OAAO,CAAA,CAAC,CAAC;;;OAAA;IAEjD,kBAAkB;IAClB,mCAAK,GAAL;QACE,6BAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACjC,CAAC;IAEH,0BAAC;AAAD,CAAC,AAxBD,IAwBC;AAxBY,kDAAmB"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/AbortSignalImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/AbortSignalImpl.d.ts new file mode 100644 index 0000000..c2581b1 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/AbortSignalImpl.d.ts @@ -0,0 +1,23 @@ +import { EventHandler, AbortSignal } from "./interfaces"; +import { EventTargetImpl } from "./EventTargetImpl"; +/** + * Represents a signal object that communicates with a DOM request and abort + * it through an AbortController. + */ +export declare class AbortSignalImpl extends EventTargetImpl implements AbortSignal { + _abortedFlag: boolean; + _abortAlgorithms: Set<(...args: any[]) => any>; + /** + * Initializes a new instance of `AbortSignal`. + */ + private constructor(); + /** @inheritdoc */ + get aborted(): boolean; + /** @inheritdoc */ + get onabort(): EventHandler; + set onabort(val: EventHandler); + /** + * Creates a new `AbortSignal`. + */ + static _create(): AbortSignalImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/AbortSignalImpl.js b/node_modules/@oozcitak/dom/lib/dom/AbortSignalImpl.js new file mode 100644 index 0000000..23d93c8 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/AbortSignalImpl.js @@ -0,0 +1,59 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var EventTargetImpl_1 = require("./EventTargetImpl"); +var algorithm_1 = require("../algorithm"); +/** + * Represents a signal object that communicates with a DOM request and abort + * it through an AbortController. + */ +var AbortSignalImpl = /** @class */ (function (_super) { + __extends(AbortSignalImpl, _super); + /** + * Initializes a new instance of `AbortSignal`. + */ + function AbortSignalImpl() { + var _this = _super.call(this) || this; + _this._abortedFlag = false; + _this._abortAlgorithms = new Set(); + return _this; + } + Object.defineProperty(AbortSignalImpl.prototype, "aborted", { + /** @inheritdoc */ + get: function () { return this._abortedFlag; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbortSignalImpl.prototype, "onabort", { + /** @inheritdoc */ + get: function () { + return algorithm_1.event_getterEventHandlerIDLAttribute(this, "onabort"); + }, + set: function (val) { + algorithm_1.event_setterEventHandlerIDLAttribute(this, "onabort", val); + }, + enumerable: true, + configurable: true + }); + /** + * Creates a new `AbortSignal`. + */ + AbortSignalImpl._create = function () { + return new AbortSignalImpl(); + }; + return AbortSignalImpl; +}(EventTargetImpl_1.EventTargetImpl)); +exports.AbortSignalImpl = AbortSignalImpl; +//# sourceMappingURL=AbortSignalImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/AbortSignalImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/AbortSignalImpl.js.map new file mode 100644 index 0000000..722850d --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/AbortSignalImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AbortSignalImpl.js","sourceRoot":"","sources":["../../src/dom/AbortSignalImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,qDAAmD;AACnD,0CAEqB;AAErB;;;GAGG;AACH;IAAqC,mCAAe;IAKlD;;OAEG;IACH;QAAA,YACE,iBAAO,SACR;QARD,kBAAY,GAAY,KAAK,CAAA;QAC7B,sBAAgB,GAAiC,IAAI,GAAG,EAAE,CAAA;;IAO1D,CAAC;IAGD,sBAAI,oCAAO;QADX,kBAAkB;aAClB,cAAyB,OAAO,IAAI,CAAC,YAAY,CAAA,CAAC,CAAC;;;OAAA;IAGnD,sBAAI,oCAAO;QADX,kBAAkB;aAClB;YACE,OAAO,gDAAoC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;QAC9D,CAAC;aACD,UAAY,GAAiB;YAC3B,gDAAoC,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,CAAA;QAC5D,CAAC;;;OAHA;IAKD;;OAEG;IACI,uBAAO,GAAd;QACE,OAAO,IAAI,eAAe,EAAE,CAAA;IAC9B,CAAC;IAEH,sBAAC;AAAD,CAAC,AA9BD,CAAqC,iCAAe,GA8BnD;AA9BY,0CAAe"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/AbstractRangeImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/AbstractRangeImpl.d.ts new file mode 100644 index 0000000..5a6d3c5 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/AbstractRangeImpl.d.ts @@ -0,0 +1,23 @@ +import { Node, BoundaryPoint, AbstractRange } from "./interfaces"; +/** + * Represents an abstract range with a start and end boundary point. + */ +export declare abstract class AbstractRangeImpl implements AbstractRange { + abstract _start: BoundaryPoint; + abstract _end: BoundaryPoint; + get _startNode(): Node; + get _startOffset(): number; + get _endNode(): Node; + get _endOffset(): number; + get _collapsed(): boolean; + /** @inheritdoc */ + get startContainer(): Node; + /** @inheritdoc */ + get startOffset(): number; + /** @inheritdoc */ + get endContainer(): Node; + /** @inheritdoc */ + get endOffset(): number; + /** @inheritdoc */ + get collapsed(): boolean; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/AbstractRangeImpl.js b/node_modules/@oozcitak/dom/lib/dom/AbstractRangeImpl.js new file mode 100644 index 0000000..a168613 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/AbstractRangeImpl.js @@ -0,0 +1,70 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Represents an abstract range with a start and end boundary point. + */ +var AbstractRangeImpl = /** @class */ (function () { + function AbstractRangeImpl() { + } + Object.defineProperty(AbstractRangeImpl.prototype, "_startNode", { + get: function () { return this._start[0]; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractRangeImpl.prototype, "_startOffset", { + get: function () { return this._start[1]; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractRangeImpl.prototype, "_endNode", { + get: function () { return this._end[0]; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractRangeImpl.prototype, "_endOffset", { + get: function () { return this._end[1]; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractRangeImpl.prototype, "_collapsed", { + get: function () { + return (this._start[0] === this._end[0] && + this._start[1] === this._end[1]); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractRangeImpl.prototype, "startContainer", { + /** @inheritdoc */ + get: function () { return this._startNode; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractRangeImpl.prototype, "startOffset", { + /** @inheritdoc */ + get: function () { return this._startOffset; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractRangeImpl.prototype, "endContainer", { + /** @inheritdoc */ + get: function () { return this._endNode; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractRangeImpl.prototype, "endOffset", { + /** @inheritdoc */ + get: function () { return this._endOffset; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractRangeImpl.prototype, "collapsed", { + /** @inheritdoc */ + get: function () { return this._collapsed; }, + enumerable: true, + configurable: true + }); + return AbstractRangeImpl; +}()); +exports.AbstractRangeImpl = AbstractRangeImpl; +//# sourceMappingURL=AbstractRangeImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/AbstractRangeImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/AbstractRangeImpl.js.map new file mode 100644 index 0000000..6b27cd9 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/AbstractRangeImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AbstractRangeImpl.js","sourceRoot":"","sources":["../../src/dom/AbstractRangeImpl.ts"],"names":[],"mappings":";;AAEA;;GAEG;AACH;IAAA;IA8BA,CAAC;IAzBC,sBAAI,yCAAU;aAAd,cAAyB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC;;;OAAA;IAChD,sBAAI,2CAAY;aAAhB,cAA6B,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC;;;OAAA;IACpD,sBAAI,uCAAQ;aAAZ,cAAuB,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC;;;OAAA;IAC5C,sBAAI,yCAAU;aAAd,cAA2B,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC;;;OAAA;IAEhD,sBAAI,yCAAU;aAAd;YACE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBACrC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;QACpC,CAAC;;;OAAA;IAGD,sBAAI,6CAAc;QADlB,kBAAkB;aAClB,cAA6B,OAAO,IAAI,CAAC,UAAU,CAAA,CAAC,CAAC;;;OAAA;IAGrD,sBAAI,0CAAW;QADf,kBAAkB;aAClB,cAA4B,OAAO,IAAI,CAAC,YAAY,CAAA,CAAC,CAAC;;;OAAA;IAGtD,sBAAI,2CAAY;QADhB,kBAAkB;aAClB,cAA2B,OAAO,IAAI,CAAC,QAAQ,CAAA,CAAC,CAAC;;;OAAA;IAGjD,sBAAI,wCAAS;QADb,kBAAkB;aAClB,cAA0B,OAAO,IAAI,CAAC,UAAU,CAAA,CAAC,CAAC;;;OAAA;IAGlD,sBAAI,wCAAS;QADb,kBAAkB;aAClB,cAA2B,OAAO,IAAI,CAAC,UAAU,CAAA,CAAC,CAAC;;;OAAA;IAErD,wBAAC;AAAD,CAAC,AA9BD,IA8BC;AA9BqB,8CAAiB"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/AttrImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/AttrImpl.d.ts new file mode 100644 index 0000000..9ef8981 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/AttrImpl.d.ts @@ -0,0 +1,45 @@ +import { Element, NodeType, Attr, Document } from "./interfaces"; +import { NodeImpl } from "./NodeImpl"; +/** + * Represents an attribute of an element node. + */ +export declare class AttrImpl extends NodeImpl implements Attr { + _nodeType: NodeType; + _localName: string; + _namespace: string | null; + _namespacePrefix: string | null; + _element: Element | null; + _value: string; + /** + * Initializes a new instance of `Attr`. + * + * @param localName - local name + */ + private constructor(); + /** @inheritdoc */ + specified: boolean; + /** @inheritdoc */ + get ownerElement(): Element | null; + /** @inheritdoc */ + get namespaceURI(): string | null; + /** @inheritdoc */ + get prefix(): string | null; + /** @inheritdoc */ + get localName(): string; + /** @inheritdoc */ + get name(): string; + /** @inheritdoc */ + get value(): string; + set value(value: string); + /** + * Returns the qualified name. + */ + get _qualifiedName(): string; + /** + * Creates an `Attr`. + * + * @param document - owner document + * @param localName - local name + */ + static _create(document: Document, localName: string): AttrImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/AttrImpl.js b/node_modules/@oozcitak/dom/lib/dom/AttrImpl.js new file mode 100644 index 0000000..7fde932 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/AttrImpl.js @@ -0,0 +1,118 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("./interfaces"); +var NodeImpl_1 = require("./NodeImpl"); +var algorithm_1 = require("../algorithm"); +var WebIDLAlgorithm_1 = require("../algorithm/WebIDLAlgorithm"); +/** + * Represents an attribute of an element node. + */ +var AttrImpl = /** @class */ (function (_super) { + __extends(AttrImpl, _super); + /** + * Initializes a new instance of `Attr`. + * + * @param localName - local name + */ + function AttrImpl(localName) { + var _this = _super.call(this) || this; + _this._namespace = null; + _this._namespacePrefix = null; + _this._element = null; + _this._value = ''; + _this._localName = localName; + return _this; + } + Object.defineProperty(AttrImpl.prototype, "ownerElement", { + /** @inheritdoc */ + get: function () { return this._element; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AttrImpl.prototype, "namespaceURI", { + /** @inheritdoc */ + get: function () { return this._namespace; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AttrImpl.prototype, "prefix", { + /** @inheritdoc */ + get: function () { return this._namespacePrefix; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AttrImpl.prototype, "localName", { + /** @inheritdoc */ + get: function () { return this._localName; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AttrImpl.prototype, "name", { + /** @inheritdoc */ + get: function () { return this._qualifiedName; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AttrImpl.prototype, "value", { + /** @inheritdoc */ + get: function () { return this._value; }, + set: function (value) { + /** + * The value attribute’s setter must set an existing attribute value with + * context object and the given value. + */ + algorithm_1.attr_setAnExistingAttributeValue(this, value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AttrImpl.prototype, "_qualifiedName", { + /** + * Returns the qualified name. + */ + get: function () { + /** + * An attribute’s qualified name is its local name if its namespace prefix + * is null, and its namespace prefix, followed by ":", followed by its + * local name, otherwise. + */ + return (this._namespacePrefix !== null ? + this._namespacePrefix + ':' + this._localName : + this._localName); + }, + enumerable: true, + configurable: true + }); + /** + * Creates an `Attr`. + * + * @param document - owner document + * @param localName - local name + */ + AttrImpl._create = function (document, localName) { + var node = new AttrImpl(localName); + node._nodeDocument = document; + return node; + }; + return AttrImpl; +}(NodeImpl_1.NodeImpl)); +exports.AttrImpl = AttrImpl; +/** + * Initialize prototype properties + */ +WebIDLAlgorithm_1.idl_defineConst(AttrImpl.prototype, "_nodeType", interfaces_1.NodeType.Attribute); +WebIDLAlgorithm_1.idl_defineConst(AttrImpl.prototype, "specified", true); +//# sourceMappingURL=AttrImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/AttrImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/AttrImpl.js.map new file mode 100644 index 0000000..16b5361 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/AttrImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AttrImpl.js","sourceRoot":"","sources":["../../src/dom/AttrImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAgE;AAChE,uCAAqC;AACrC,0CAA+D;AAC/D,gEAA8D;AAE9D;;GAEG;AACH;IAA8B,4BAAQ;IASpC;;;;OAIG;IACH,kBAAoB,SAAiB;QAArC,YACE,iBAAO,SAGR;QAdD,gBAAU,GAAkB,IAAI,CAAA;QAChC,sBAAgB,GAAkB,IAAI,CAAA;QACtC,cAAQ,GAAmB,IAAI,CAAA;QAC/B,YAAM,GAAW,EA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CAAC,AA1ED,CAA8B,mBAAQ,GA0ErC;AA1EY,4BAAQ;AA4ErB;;GAEG;AACH,iCAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,WAAW,EAAE,qBAAQ,CAAC,SAAS,CAAC,CAAA;AACpE,iCAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,WAAW,EAAE,IAAI,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/CDATASectionImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/CDATASectionImpl.d.ts new file mode 100644 index 0000000..e2ff3bf --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/CDATASectionImpl.d.ts @@ -0,0 +1,21 @@ +import { TextImpl } from "./TextImpl"; +import { NodeType, CDATASection, Document } from "./interfaces"; +/** + * Represents a CDATA node. + */ +export declare class CDATASectionImpl extends TextImpl implements CDATASection { + _nodeType: NodeType; + /** + * Initializes a new instance of `CDATASection`. + * + * @param data - node contents + */ + private constructor(); + /** + * Creates a new `CDATASection`. + * + * @param document - owner document + * @param data - node contents + */ + static _create(document: Document, data?: string): CDATASectionImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/CDATASectionImpl.js b/node_modules/@oozcitak/dom/lib/dom/CDATASectionImpl.js new file mode 100644 index 0000000..65aade3 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/CDATASectionImpl.js @@ -0,0 +1,51 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var TextImpl_1 = require("./TextImpl"); +var interfaces_1 = require("./interfaces"); +var WebIDLAlgorithm_1 = require("../algorithm/WebIDLAlgorithm"); +/** + * Represents a CDATA node. + */ +var CDATASectionImpl = /** @class */ (function (_super) { + __extends(CDATASectionImpl, _super); + /** + * Initializes a new instance of `CDATASection`. + * + * @param data - node contents + */ + function CDATASectionImpl(data) { + return _super.call(this, data) || this; + } + /** + * Creates a new `CDATASection`. + * + * @param document - owner document + * @param data - node contents + */ + CDATASectionImpl._create = function (document, data) { + if (data === void 0) { data = ''; } + var node = new CDATASectionImpl(data); + node._nodeDocument = document; + return node; + }; + return CDATASectionImpl; +}(TextImpl_1.TextImpl)); +exports.CDATASectionImpl = CDATASectionImpl; +/** + * Initialize prototype properties + */ +WebIDLAlgorithm_1.idl_defineConst(CDATASectionImpl.prototype, "_nodeType", interfaces_1.NodeType.CData); +//# sourceMappingURL=CDATASectionImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/CDATASectionImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/CDATASectionImpl.js.map new file mode 100644 index 0000000..0533e57 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/CDATASectionImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CDATASectionImpl.js","sourceRoot":"","sources":["../../src/dom/CDATASectionImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uCAAqC;AACrC,2CAA+D;AAC/D,gEAA8D;AAE9D;;GAEG;AACH;IAAsC,oCAAQ;IAI5C;;;;OAIG;IACH,0BAAoB,IAAY;eAC9B,kBAAM,IAAI,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACI,wBAAO,GAAd,UAAe,QAAkB,EAAE,IAAiB;QAAjB,qBAAA,EAAA,SAAiB;QAClD,IAAM,IAAI,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAA;QACvC,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAA;QAC7B,OAAO,IAAI,CAAA;IACb,CAAC;IAEH,uBAAC;AAAD,CAAC,AAzBD,CAAsC,mBAAQ,GAyB7C;AAzBY,4CAAgB;AA2B7B;;GAEG;AACH,iCAAe,CAAC,gBAAgB,CAAC,SAAS,EAAE,WAAW,EAAE,qBAAQ,CAAC,KAAK,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/CharacterDataImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/CharacterDataImpl.d.ts new file mode 100644 index 0000000..bcff169 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/CharacterDataImpl.d.ts @@ -0,0 +1,35 @@ +import { Element, Node, CharacterData } from "./interfaces"; +import { NodeImpl } from "./NodeImpl"; +/** + * Represents a generic text node. + */ +export declare abstract class CharacterDataImpl extends NodeImpl implements CharacterData { + _data: string; + /** + * Initializes a new instance of `CharacterData`. + * + * @param data - the text content + */ + protected constructor(data: string); + /** @inheritdoc */ + get data(): string; + set data(value: string); + /** @inheritdoc */ + get length(): number; + /** @inheritdoc */ + substringData(offset: number, count: number): string; + /** @inheritdoc */ + appendData(data: string): void; + /** @inheritdoc */ + insertData(offset: number, data: string): void; + /** @inheritdoc */ + deleteData(offset: number, count: number): void; + /** @inheritdoc */ + replaceData(offset: number, count: number, data: string): void; + get previousElementSibling(): Element | null; + get nextElementSibling(): Element | null; + before(...nodes: (Node | string)[]): void; + after(...nodes: (Node | string)[]): void; + replaceWith(...nodes: (Node | string)[]): void; + remove(): void; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/CharacterDataImpl.js b/node_modules/@oozcitak/dom/lib/dom/CharacterDataImpl.js new file mode 100644 index 0000000..bb6f653 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/CharacterDataImpl.js @@ -0,0 +1,132 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var NodeImpl_1 = require("./NodeImpl"); +var algorithm_1 = require("../algorithm"); +/** + * Represents a generic text node. + */ +var CharacterDataImpl = /** @class */ (function (_super) { + __extends(CharacterDataImpl, _super); + /** + * Initializes a new instance of `CharacterData`. + * + * @param data - the text content + */ + function CharacterDataImpl(data) { + var _this = _super.call(this) || this; + _this._data = data; + return _this; + } + Object.defineProperty(CharacterDataImpl.prototype, "data", { + /** @inheritdoc */ + get: function () { return this._data; }, + set: function (value) { + algorithm_1.characterData_replaceData(this, 0, this._data.length, value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CharacterDataImpl.prototype, "length", { + /** @inheritdoc */ + get: function () { return this._data.length; }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + CharacterDataImpl.prototype.substringData = function (offset, count) { + /** + * The substringData(offset, count) method, when invoked, must return the + * result of running substring data with node context object, offset offset, and count count. + */ + return algorithm_1.characterData_substringData(this, offset, count); + }; + /** @inheritdoc */ + CharacterDataImpl.prototype.appendData = function (data) { + /** + * The appendData(data) method, when invoked, must replace data with node + * context object, offset context object’s length, count 0, and data data. + */ + return algorithm_1.characterData_replaceData(this, this._data.length, 0, data); + }; + /** @inheritdoc */ + CharacterDataImpl.prototype.insertData = function (offset, data) { + /** + * The insertData(offset, data) method, when invoked, must replace data with + * node context object, offset offset, count 0, and data data. + */ + algorithm_1.characterData_replaceData(this, offset, 0, data); + }; + /** @inheritdoc */ + CharacterDataImpl.prototype.deleteData = function (offset, count) { + /** + * The deleteData(offset, count) method, when invoked, must replace data + * with node context object, offset offset, count count, and data the + * empty string. + */ + algorithm_1.characterData_replaceData(this, offset, count, ''); + }; + /** @inheritdoc */ + CharacterDataImpl.prototype.replaceData = function (offset, count, data) { + /** + * The replaceData(offset, count, data) method, when invoked, must replace + * data with node context object, offset offset, count count, and data data. + */ + algorithm_1.characterData_replaceData(this, offset, count, data); + }; + Object.defineProperty(CharacterDataImpl.prototype, "previousElementSibling", { + // MIXIN: NonDocumentTypeChildNode + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CharacterDataImpl.prototype, "nextElementSibling", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); }, + enumerable: true, + configurable: true + }); + // MIXIN: ChildNode + /* istanbul ignore next */ + CharacterDataImpl.prototype.before = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); + }; + /* istanbul ignore next */ + CharacterDataImpl.prototype.after = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); + }; + /* istanbul ignore next */ + CharacterDataImpl.prototype.replaceWith = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); + }; + /* istanbul ignore next */ + CharacterDataImpl.prototype.remove = function () { throw new Error("Mixin: ChildNode not implemented."); }; + return CharacterDataImpl; +}(NodeImpl_1.NodeImpl)); +exports.CharacterDataImpl = CharacterDataImpl; +//# sourceMappingURL=CharacterDataImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/CharacterDataImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/CharacterDataImpl.js.map new file mode 100644 index 0000000..62eca42 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/CharacterDataImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CharacterDataImpl.js","sourceRoot":"","sources":["../../src/dom/CharacterDataImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAC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AGG;QACH,qCAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;IACtD,CAAC;IAKD,sBAAI,qDAAsB;QAF1B,kCAAkC;QAClC,0BAA0B;aAC1B,cAA+C,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA,CAAC,CAAC;;;OAAA;IAEpH,sBAAI,iDAAkB;QADtB,0BAA0B;aAC1B,cAA2C,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA,CAAC,CAAC;;;OAAA;IAEhH,mBAAmB;IACnB,0BAA0B;IAC1B,kCAAM,GAAN;QAAO,eAA2B;aAA3B,UAA2B,EAA3B,qBAA2B,EAA3B,IAA2B;YAA3B,0BAA2B;;QAAU,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;IAAC,CAAC;IAClG,0BAA0B;IAC1B,iCAAK,GAAL;QAAM,eAA2B;aAA3B,UAA2B,EAA3B,qBAA2B,EAA3B,IAA2B;YAA3B,0BAA2B;;QAAU,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;IAAC,CAAC;IACjG,0BAA0B;IAC1B,uCAAW,GAAX;QAAY,eAA2B;aAA3B,UAA2B,EAA3B,qBAA2B,EAA3B,IAA2B;YAA3B,0BAA2B;;QAAU,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;IAAC,CAAC;IACvG,0BAA0B;IAC1B,kCAAM,GAAN,cAAiB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA,CAAC,CAAC;IAEzE,wBAAC;AAAD,CAAC,AAvFD,CAAgD,mBAAQ,GAuFvD;AAvFqB,8CAAiB"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/ChildNodeImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/ChildNodeImpl.d.ts new file mode 100644 index 0000000..7d30cd1 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/ChildNodeImpl.d.ts @@ -0,0 +1,16 @@ +import { Node, ChildNode } from "./interfaces"; +/** + * Represents a mixin that extends child nodes that can have siblings + * including doctypes. This mixin is implemented by {@link Element}, + * {@link CharacterData} and {@link DocumentType}. + */ +export declare class ChildNodeImpl implements ChildNode { + /** @inheritdoc */ + before(...nodes: (Node | string)[]): void; + /** @inheritdoc */ + after(...nodes: (Node | string)[]): void; + /** @inheritdoc */ + replaceWith(...nodes: (Node | string)[]): void; + /** @inheritdoc */ + remove(): void; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/ChildNodeImpl.js b/node_modules/@oozcitak/dom/lib/dom/ChildNodeImpl.js new file mode 100644 index 0000000..0020c15 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/ChildNodeImpl.js @@ -0,0 +1,165 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var util_1 = require("../util"); +var algorithm_1 = require("../algorithm"); +/** + * Represents a mixin that extends child nodes that can have siblings + * including doctypes. This mixin is implemented by {@link Element}, + * {@link CharacterData} and {@link DocumentType}. + */ +var ChildNodeImpl = /** @class */ (function () { + function ChildNodeImpl() { + } + /** @inheritdoc */ + ChildNodeImpl.prototype.before = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + /** + * 1. Let parent be context object’s parent. + * 2. If parent is null, then return. + */ + var context = util_1.Cast.asNode(this); + var parent = context._parent; + if (parent === null) + return; + /** + * 3. Let viablePreviousSibling be context object’s first preceding + * sibling not in nodes, and null otherwise. + */ + var viablePreviousSibling = context._previousSibling; + var flag = true; + while (flag && viablePreviousSibling) { + flag = false; + for (var i = 0; i < nodes.length; i++) { + var child = nodes[i]; + if (child === viablePreviousSibling) { + viablePreviousSibling = viablePreviousSibling._previousSibling; + flag = true; + break; + } + } + } + /** + * 4. Let node be the result of converting nodes into a node, given nodes + * and context object’s node document. + */ + var node = algorithm_1.parentNode_convertNodesIntoANode(nodes, context._nodeDocument); + /** + * 5. If viablePreviousSibling is null, set it to parent’s first child, + * and to viablePreviousSibling’s next sibling otherwise. + */ + if (viablePreviousSibling === null) + viablePreviousSibling = parent._firstChild; + else + viablePreviousSibling = viablePreviousSibling._nextSibling; + /** + * 6. Pre-insert node into parent before viablePreviousSibling. + */ + algorithm_1.mutation_preInsert(node, parent, viablePreviousSibling); + }; + /** @inheritdoc */ + ChildNodeImpl.prototype.after = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + /** + * 1. Let parent be context object’s parent. + * 2. If parent is null, then return. + */ + var context = util_1.Cast.asNode(this); + var parent = context._parent; + if (!parent) + return; + /** + * 3. Let viableNextSibling be context object’s first following sibling not + * in nodes, and null otherwise. + */ + var viableNextSibling = context._nextSibling; + var flag = true; + while (flag && viableNextSibling) { + flag = false; + for (var i = 0; i < nodes.length; i++) { + var child = nodes[i]; + if (child === viableNextSibling) { + viableNextSibling = viableNextSibling._nextSibling; + flag = true; + break; + } + } + } + /** + * 4. Let node be the result of converting nodes into a node, given nodes + * and context object’s node document. + */ + var node = algorithm_1.parentNode_convertNodesIntoANode(nodes, context._nodeDocument); + /** + * 5. Pre-insert node into parent before viableNextSibling. + */ + algorithm_1.mutation_preInsert(node, parent, viableNextSibling); + }; + /** @inheritdoc */ + ChildNodeImpl.prototype.replaceWith = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + /** + * 1. Let parent be context object’s parent. + * 2. If parent is null, then return. + */ + var context = util_1.Cast.asNode(this); + var parent = context._parent; + if (!parent) + return; + /** + * 3. Let viableNextSibling be context object’s first following sibling not + * in nodes, and null otherwise. + */ + var viableNextSibling = context._nextSibling; + var flag = true; + while (flag && viableNextSibling) { + flag = false; + for (var i = 0; i < nodes.length; i++) { + var child = nodes[i]; + if (child === viableNextSibling) { + viableNextSibling = viableNextSibling._nextSibling; + flag = true; + break; + } + } + } + /** + * 4. Let node be the result of converting nodes into a node, given nodes + * and context object’s node document. + */ + var node = algorithm_1.parentNode_convertNodesIntoANode(nodes, context._nodeDocument); + /** + * 5. If context object’s parent is parent, replace the context object with + * node within parent. + * _Note:_ Context object could have been inserted into node. + * 6. Otherwise, pre-insert node into parent before viableNextSibling. + */ + if (context._parent === parent) + algorithm_1.mutation_replace(context, node, parent); + else + algorithm_1.mutation_preInsert(node, parent, viableNextSibling); + }; + /** @inheritdoc */ + ChildNodeImpl.prototype.remove = function () { + /** + * 1. If context object’s parent is null, then return. + * 2. Remove the context object from context object’s parent. + */ + var context = util_1.Cast.asNode(this); + var parent = context._parent; + if (!parent) + return; + algorithm_1.mutation_remove(context, parent); + }; + return ChildNodeImpl; +}()); +exports.ChildNodeImpl = ChildNodeImpl; +//# sourceMappingURL=ChildNodeImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/ChildNodeImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/ChildNodeImpl.js.map new file mode 100644 index 0000000..6136529 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/ChildNodeImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ChildNodeImpl.js","sourceRoot":"","sources":["../../src/dom/ChildNodeImpl.ts"],"names":[],"mappings":";;AACA,gCAA8B;AAC9B,0CAGqB;AAErB;;;;GAIG;AACH;IAAA;IA2JA,CAAC;IAzJC,kBAAkB;IAClB,8BAAM,GAAN;QAAO,eAA2B;aAA3B,UAA2B,EAA3B,qBAA2B,EAA3B,IAA2B;YAA3B,0BAA2B;;QAChC;;;WAGG;QACH,IAAM,OAAO,GAAG,WAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACjC,IAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAA;QAC9B,IAAI,MAAM,KAAK,IAAI;YAAE,OAAM;QAE3B;;;WAGG;QACH,IAAI,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,CAAA;QACpD,IAAI,IAAI,GAAG,IAAI,CAAA;QACf,OAAO,IAAI,IAAI,qBA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AAO,KAAK,MAAM;YAC5B,4BAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;;YAEvC,8BAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAA;IACvD,CAAC;IAED,kBAAkB;IAClB,8BAAM,GAAN;QACE;;;WAGG;QACH,IAAM,OAAO,GAAG,WAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACjC,IAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAA;QAC9B,IAAI,CAAC,MAAM;YAAE,OAAM;QAEnB,2BAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAClC,CAAC;IAEH,oBAAC;AAAD,CAAC,AA3JD,IA2JC;AA3JY,sCAAa"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/CommentImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/CommentImpl.d.ts new file mode 100644 index 0000000..96221a1 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/CommentImpl.d.ts @@ -0,0 +1,21 @@ +import { NodeType, Comment, Document } from "./interfaces"; +import { CharacterDataImpl } from "./CharacterDataImpl"; +/** + * Represents a comment node. + */ +export declare class CommentImpl extends CharacterDataImpl implements Comment { + _nodeType: NodeType; + /** + * Initializes a new instance of `Comment`. + * + * @param data - the text content + */ + constructor(data?: string); + /** + * Creates a new `Comment`. + * + * @param document - owner document + * @param data - node contents + */ + static _create(document: Document, data?: string): CommentImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/CommentImpl.js b/node_modules/@oozcitak/dom/lib/dom/CommentImpl.js new file mode 100644 index 0000000..902d15c --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/CommentImpl.js @@ -0,0 +1,52 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("./interfaces"); +var CharacterDataImpl_1 = require("./CharacterDataImpl"); +var WebIDLAlgorithm_1 = require("../algorithm/WebIDLAlgorithm"); +/** + * Represents a comment node. + */ +var CommentImpl = /** @class */ (function (_super) { + __extends(CommentImpl, _super); + /** + * Initializes a new instance of `Comment`. + * + * @param data - the text content + */ + function CommentImpl(data) { + if (data === void 0) { data = ''; } + return _super.call(this, data) || this; + } + /** + * Creates a new `Comment`. + * + * @param document - owner document + * @param data - node contents + */ + CommentImpl._create = function (document, data) { + if (data === void 0) { data = ''; } + var node = new CommentImpl(data); + node._nodeDocument = document; + return node; + }; + return CommentImpl; +}(CharacterDataImpl_1.CharacterDataImpl)); +exports.CommentImpl = CommentImpl; +/** + * Initialize prototype properties + */ +WebIDLAlgorithm_1.idl_defineConst(CommentImpl.prototype, "_nodeType", interfaces_1.NodeType.Comment); +//# sourceMappingURL=CommentImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/CommentImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/CommentImpl.js.map new file mode 100644 index 0000000..bae5f09 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/CommentImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CommentImpl.js","sourceRoot":"","sources":["../../src/dom/CommentImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA0D;AAC1D,yDAAuD;AACvD,gEAA8D;AAE9D;;GAEG;AACH;IAAiC,+BAAiB;IAIhD;;;;OAIG;IACH,qBAAmB,IAAiB;QAAjB,qBAAA,EAAA,SAAiB;eAClC,kBAAM,IAAI,CAAC;IACb,CAAC;IAGD;;;;;OAKG;IACI,mBAAO,GAAd,UAAe,QAAkB,EAAE,IAAiB;QAAjB,qBAAA,EAAA,SAAiB;QAClD,IAAM,IAAI,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAA;QAClC,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAA;QAC7B,OAAO,IAAI,CAAA;IACb,CAAC;IAEH,kBAAC;AAAD,CAAC,AA1BD,CAAiC,qCAAiB,GA0BjD;AA1BY,kCAAW;AA4BxB;;GAEG;AACH,iCAAe,CAAC,WAAW,CAAC,SAAS,EAAE,WAAW,EAAE,qBAAQ,CAAC,OAAO,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/CustomEventImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/CustomEventImpl.d.ts new file mode 100644 index 0000000..509feb0 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/CustomEventImpl.d.ts @@ -0,0 +1,16 @@ +import { CustomEventInit, CustomEvent } from "./interfaces"; +import { EventImpl } from "./EventImpl"; +/** + * Represents and event that carries custom data. + */ +export declare class CustomEventImpl extends EventImpl implements CustomEvent { + protected _detail: any; + /** + * Initializes a new instance of `CustomEvent`. + */ + constructor(type: string, eventInit?: CustomEventInit); + /** @inheritdoc */ + get detail(): any; + /** @inheritdoc */ + initCustomEvent(type: string, bubbles?: boolean, cancelable?: boolean, detail?: any): void; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/CustomEventImpl.js b/node_modules/@oozcitak/dom/lib/dom/CustomEventImpl.js new file mode 100644 index 0000000..299b3e2 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/CustomEventImpl.js @@ -0,0 +1,60 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var EventImpl_1 = require("./EventImpl"); +var algorithm_1 = require("../algorithm"); +/** + * Represents and event that carries custom data. + */ +var CustomEventImpl = /** @class */ (function (_super) { + __extends(CustomEventImpl, _super); + /** + * Initializes a new instance of `CustomEvent`. + */ + function CustomEventImpl(type, eventInit) { + var _this = _super.call(this, type, eventInit) || this; + _this._detail = null; + _this._detail = (eventInit && eventInit.detail) || null; + return _this; + } + Object.defineProperty(CustomEventImpl.prototype, "detail", { + /** @inheritdoc */ + get: function () { return this._detail; }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + CustomEventImpl.prototype.initCustomEvent = function (type, bubbles, cancelable, detail) { + if (bubbles === void 0) { bubbles = false; } + if (cancelable === void 0) { cancelable = false; } + if (detail === void 0) { detail = null; } + /** + * 1. If the context object’s dispatch flag is set, then return. + */ + if (this._dispatchFlag) + return; + /** + * 2. Initialize the context object with type, bubbles, and cancelable. + */ + algorithm_1.event_initialize(this, type, bubbles, cancelable); + /** + * 3. Set the context object’s detail attribute to detail. + */ + this._detail = detail; + }; + return CustomEventImpl; +}(EventImpl_1.EventImpl)); +exports.CustomEventImpl = CustomEventImpl; +//# sourceMappingURL=CustomEventImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/CustomEventImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/CustomEventImpl.js.map new file mode 100644 index 0000000..1e4a0c2 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/CustomEventImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CustomEventImpl.js","sourceRoot":"","sources":["../../src/dom/CustomEventImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,yCAAuC;AACvC,0CAA+C;AAE/C;;GAEG;AACH;IAAqC,mCAAS;IAI5C;;OAEG;IACH,yBAAmB,IAAY,EAAE,SAA2B;QAA5D,YACE,kBAAM,IAAI,EAAE,SAAS,CAAC,SAGvB;QATS,aAAO,GAAQ,IAAI,CAAA;QAQ3B,KAAI,CAAC,OAAO,GAAG,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,IAAI,CAAA;;IACxD,CAAC;IAGD,sBAAI,mCAAM;QADV,kBAAkB;aAClB,cAAoB,OAAO,IAAI,CAAC,OAAO,CAAA,CAAC,CAAC;;;OAAA;IAEzC,kBAAkB;IAClB,yCAAe,GAAf,UAAgB,IAAY,EAAE,OAAe,EAAE,UAAkB,EAAE,MAAkB;QAAvD,wBAAA,EAAA,eAAe;QAAE,2BAAA,EAAA,kBAAkB;QAAE,uBAAA,EAAA,aAAkB;QACnF;;WAEG;QACH,IAAI,IAAI,CAAC,aAAa;YAAE,OAAM;QAE9B;;WAEG;QACH,4BAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,CAAA;QAEjD;;WAEG;QACH,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACvB,CAAC;IAEH,sBAAC;AAAD,CAAC,AAlCD,CAAqC,qBAAS,GAkC7C;AAlCY,0CAAe"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/DOMException.d.ts b/node_modules/@oozcitak/dom/lib/dom/DOMException.d.ts new file mode 100644 index 0000000..e0c39fb --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DOMException.d.ts @@ -0,0 +1,171 @@ +/** + * Represents the base class of `Error` objects used by this module. + */ +export declare class DOMException extends Error { + /** + * Returns the name of the error message. + */ + readonly name: string; + /** + * + * @param name - message name + * @param message - error message + */ + constructor(name: string, message?: string); +} +export declare class DOMStringSizeError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class WrongDocumentError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class NoDataAllowedError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class NoModificationAllowedError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class NotSupportedError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class InUseAttributeError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class InvalidStateError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class InvalidModificationError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class NamespaceError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class InvalidAccessError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class ValidationError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class TypeMismatchError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class SecurityError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class NetworkError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class AbortError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class URLMismatchError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class QuotaExceededError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class TimeoutError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class InvalidNodeTypeError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class DataCloneError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class NotImplementedError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class HierarchyRequestError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class NotFoundError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class IndexSizeError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class SyntaxError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} +export declare class InvalidCharacterError extends DOMException { + /** + * @param message - error message + */ + constructor(message?: string); +} diff --git a/node_modules/@oozcitak/dom/lib/dom/DOMException.js b/node_modules/@oozcitak/dom/lib/dom/DOMException.js new file mode 100644 index 0000000..7ff4bd7 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DOMException.js @@ -0,0 +1,347 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Represents the base class of `Error` objects used by this module. + */ +var DOMException = /** @class */ (function (_super) { + __extends(DOMException, _super); + /** + * + * @param name - message name + * @param message - error message + */ + function DOMException(name, message) { + if (message === void 0) { message = ""; } + var _this = _super.call(this, message) || this; + _this.name = name; + return _this; + } + return DOMException; +}(Error)); +exports.DOMException = DOMException; +var DOMStringSizeError = /** @class */ (function (_super) { + __extends(DOMStringSizeError, _super); + /** + * @param message - error message + */ + function DOMStringSizeError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "DOMStringSizeError", message) || this; + } + return DOMStringSizeError; +}(DOMException)); +exports.DOMStringSizeError = DOMStringSizeError; +var WrongDocumentError = /** @class */ (function (_super) { + __extends(WrongDocumentError, _super); + /** + * @param message - error message + */ + function WrongDocumentError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "WrongDocumentError", "The object is in the wrong document. " + message) || this; + } + return WrongDocumentError; +}(DOMException)); +exports.WrongDocumentError = WrongDocumentError; +var NoDataAllowedError = /** @class */ (function (_super) { + __extends(NoDataAllowedError, _super); + /** + * @param message - error message + */ + function NoDataAllowedError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "NoDataAllowedError", message) || this; + } + return NoDataAllowedError; +}(DOMException)); +exports.NoDataAllowedError = NoDataAllowedError; +var NoModificationAllowedError = /** @class */ (function (_super) { + __extends(NoModificationAllowedError, _super); + /** + * @param message - error message + */ + function NoModificationAllowedError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "NoModificationAllowedError", "The object can not be modified. " + message) || this; + } + return NoModificationAllowedError; +}(DOMException)); +exports.NoModificationAllowedError = NoModificationAllowedError; +var NotSupportedError = /** @class */ (function (_super) { + __extends(NotSupportedError, _super); + /** + * @param message - error message + */ + function NotSupportedError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "NotSupportedError", "The operation is not supported. " + message) || this; + } + return NotSupportedError; +}(DOMException)); +exports.NotSupportedError = NotSupportedError; +var InUseAttributeError = /** @class */ (function (_super) { + __extends(InUseAttributeError, _super); + /** + * @param message - error message + */ + function InUseAttributeError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "InUseAttributeError", message) || this; + } + return InUseAttributeError; +}(DOMException)); +exports.InUseAttributeError = InUseAttributeError; +var InvalidStateError = /** @class */ (function (_super) { + __extends(InvalidStateError, _super); + /** + * @param message - error message + */ + function InvalidStateError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "InvalidStateError", "The object is in an invalid state. " + message) || this; + } + return InvalidStateError; +}(DOMException)); +exports.InvalidStateError = InvalidStateError; +var InvalidModificationError = /** @class */ (function (_super) { + __extends(InvalidModificationError, _super); + /** + * @param message - error message + */ + function InvalidModificationError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "InvalidModificationError", "The object can not be modified in this way. " + message) || this; + } + return InvalidModificationError; +}(DOMException)); +exports.InvalidModificationError = InvalidModificationError; +var NamespaceError = /** @class */ (function (_super) { + __extends(NamespaceError, _super); + /** + * @param message - error message + */ + function NamespaceError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "NamespaceError", "The operation is not allowed by Namespaces in XML. [XMLNS] " + message) || this; + } + return NamespaceError; +}(DOMException)); +exports.NamespaceError = NamespaceError; +var InvalidAccessError = /** @class */ (function (_super) { + __extends(InvalidAccessError, _super); + /** + * @param message - error message + */ + function InvalidAccessError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "InvalidAccessError", "The object does not support the operation or argument. " + message) || this; + } + return InvalidAccessError; +}(DOMException)); +exports.InvalidAccessError = InvalidAccessError; +var ValidationError = /** @class */ (function (_super) { + __extends(ValidationError, _super); + /** + * @param message - error message + */ + function ValidationError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "ValidationError", message) || this; + } + return ValidationError; +}(DOMException)); +exports.ValidationError = ValidationError; +var TypeMismatchError = /** @class */ (function (_super) { + __extends(TypeMismatchError, _super); + /** + * @param message - error message + */ + function TypeMismatchError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "TypeMismatchError", message) || this; + } + return TypeMismatchError; +}(DOMException)); +exports.TypeMismatchError = TypeMismatchError; +var SecurityError = /** @class */ (function (_super) { + __extends(SecurityError, _super); + /** + * @param message - error message + */ + function SecurityError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "SecurityError", "The operation is insecure. " + message) || this; + } + return SecurityError; +}(DOMException)); +exports.SecurityError = SecurityError; +var NetworkError = /** @class */ (function (_super) { + __extends(NetworkError, _super); + /** + * @param message - error message + */ + function NetworkError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "NetworkError", "A network error occurred. " + message) || this; + } + return NetworkError; +}(DOMException)); +exports.NetworkError = NetworkError; +var AbortError = /** @class */ (function (_super) { + __extends(AbortError, _super); + /** + * @param message - error message + */ + function AbortError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "AbortError", "The operation was aborted. " + message) || this; + } + return AbortError; +}(DOMException)); +exports.AbortError = AbortError; +var URLMismatchError = /** @class */ (function (_super) { + __extends(URLMismatchError, _super); + /** + * @param message - error message + */ + function URLMismatchError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "URLMismatchError", "The given URL does not match another URL. " + message) || this; + } + return URLMismatchError; +}(DOMException)); +exports.URLMismatchError = URLMismatchError; +var QuotaExceededError = /** @class */ (function (_super) { + __extends(QuotaExceededError, _super); + /** + * @param message - error message + */ + function QuotaExceededError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "QuotaExceededError", "The quota has been exceeded. " + message) || this; + } + return QuotaExceededError; +}(DOMException)); +exports.QuotaExceededError = QuotaExceededError; +var TimeoutError = /** @class */ (function (_super) { + __extends(TimeoutError, _super); + /** + * @param message - error message + */ + function TimeoutError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "TimeoutError", "The operation timed out. " + message) || this; + } + return TimeoutError; +}(DOMException)); +exports.TimeoutError = TimeoutError; +var InvalidNodeTypeError = /** @class */ (function (_super) { + __extends(InvalidNodeTypeError, _super); + /** + * @param message - error message + */ + function InvalidNodeTypeError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "InvalidNodeTypeError", "The supplied node is incorrect or has an incorrect ancestor for this operation. " + message) || this; + } + return InvalidNodeTypeError; +}(DOMException)); +exports.InvalidNodeTypeError = InvalidNodeTypeError; +var DataCloneError = /** @class */ (function (_super) { + __extends(DataCloneError, _super); + /** + * @param message - error message + */ + function DataCloneError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "DataCloneError", "The object can not be cloned. " + message) || this; + } + return DataCloneError; +}(DOMException)); +exports.DataCloneError = DataCloneError; +var NotImplementedError = /** @class */ (function (_super) { + __extends(NotImplementedError, _super); + /** + * @param message - error message + */ + function NotImplementedError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "NotImplementedError", "The DOM method is not implemented by this module. " + message) || this; + } + return NotImplementedError; +}(DOMException)); +exports.NotImplementedError = NotImplementedError; +var HierarchyRequestError = /** @class */ (function (_super) { + __extends(HierarchyRequestError, _super); + /** + * @param message - error message + */ + function HierarchyRequestError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "HierarchyRequestError", "The operation would yield an incorrect node tree. " + message) || this; + } + return HierarchyRequestError; +}(DOMException)); +exports.HierarchyRequestError = HierarchyRequestError; +var NotFoundError = /** @class */ (function (_super) { + __extends(NotFoundError, _super); + /** + * @param message - error message + */ + function NotFoundError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "NotFoundError", "The object can not be found here. " + message) || this; + } + return NotFoundError; +}(DOMException)); +exports.NotFoundError = NotFoundError; +var IndexSizeError = /** @class */ (function (_super) { + __extends(IndexSizeError, _super); + /** + * @param message - error message + */ + function IndexSizeError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "IndexSizeError", "The index is not in the allowed range. " + message) || this; + } + return IndexSizeError; +}(DOMException)); +exports.IndexSizeError = IndexSizeError; +var SyntaxError = /** @class */ (function (_super) { + __extends(SyntaxError, _super); + /** + * @param message - error message + */ + function SyntaxError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "SyntaxError", "The string did not match the expected pattern. " + message) || this; + } + return SyntaxError; +}(DOMException)); +exports.SyntaxError = SyntaxError; +var InvalidCharacterError = /** @class */ (function (_super) { + __extends(InvalidCharacterError, _super); + /** + * @param message - error message + */ + function InvalidCharacterError(message) { + if (message === void 0) { message = ""; } + return _super.call(this, "InvalidCharacterError", "The string contains invalid characters. " + message) || this; + } + return InvalidCharacterError; +}(DOMException)); +exports.InvalidCharacterError = InvalidCharacterError; +//# sourceMappingURL=DOMException.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/DOMException.js.map b/node_modules/@oozcitak/dom/lib/dom/DOMException.js.map new file mode 100644 index 0000000..7469f4c --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DOMException.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DOMException.js","sourceRoot":"","sources":["../../src/dom/DOMException.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH;IAAkC,gCAAK;IAMrC;;;;OAIG;IACH,sBAAY,IAAY,EAAE,OAAoB;QAApB,wBAAA,EAAA,YAAoB;QAA9C,YACE,kBAAM,OAAO,CAAC,SAGf;QADC,KAAI,CAAC,IAAI,GAAG,IAAI,CAAA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OAEG;IACH,wBAAY,OAAoB;QAApB,wBAAA,EAAA,YAAoB;eAC9B,kBAAM,gBAAgB,EAAE,yCAAyC,GAAG,OAAO,CAAC;IAC9E,CAAC;IACH,qBAAC;AAAD,CAAC,AAPD,CAAoC,YAAY,GAO/C;AAPY,wCAAc;AAS3B;IAAiC,+BAAY;IAC3C;;OAEG;IACH,qBAAY,OAAoB;QAApB,wBAAA,EAAA,YAAoB;eAC9B,kBAAM,aAAa,EAAE,iDAAiD,GAAG,OAAO,CAAC;IACnF,CAAC;IACH,kBAAC;AAAD,CAAC,AAPD,CAAiC,YAAY,GAO5C;AAPY,kCAAW;AASxB;IAA2C,yCAAY;IACrD;;OAEG;IACH,+BAAY,OAAoB;QAApB,wBAAA,EAAA,YAAoB;eAC9B,kBAAM,uBAAuB,EAAE,0CAA0C,GAAG,OAAO,CAAC;IACtF,CAAC;IACH,4BAAC;AAAD,CAAC,AAPD,CAA2C,YAAY,GAOtD;AAPY,sDAAqB"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/DOMImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/DOMImpl.d.ts new file mode 100644 index 0000000..1d1f2ef --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DOMImpl.d.ts @@ -0,0 +1,48 @@ +import { DOMFeatures, Window, Node, Range } from "./interfaces"; +import { CompareCache, FixedSizeSet } from "@oozcitak/util"; +/** + * Represents an object implementing DOM algorithms. + */ +declare class DOMImpl { + private static _instance; + private _features; + private _window; + private _compareCache; + private _rangeList; + /** + * Initializes a new instance of `DOM`. + */ + private constructor(); + /** + * Sets DOM algorithm features. + * + * @param features - DOM features supported by algorithms. All features are + * enabled by default unless explicity disabled. + */ + setFeatures(features?: Partial | boolean): void; + /** + * Gets DOM algorithm features. + */ + get features(): DOMFeatures; + /** + * Gets the DOM window. + */ + get window(): Window; + /** + * Gets the global node compare cache. + */ + get compareCache(): CompareCache; + /** + * Gets the global range list. + */ + get rangeList(): FixedSizeSet; + /** + * Returns the instance of `DOM`. + */ + static get instance(): DOMImpl; +} +/** + * Represents an object implementing DOM algorithms. + */ +export declare const dom: DOMImpl; +export {}; diff --git a/node_modules/@oozcitak/dom/lib/dom/DOMImpl.js b/node_modules/@oozcitak/dom/lib/dom/DOMImpl.js new file mode 100644 index 0000000..77b201e --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DOMImpl.js @@ -0,0 +1,100 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var util_1 = require("@oozcitak/util"); +var CreateAlgorithm_1 = require("../algorithm/CreateAlgorithm"); +/** + * Represents an object implementing DOM algorithms. + */ +var DOMImpl = /** @class */ (function () { + /** + * Initializes a new instance of `DOM`. + */ + function DOMImpl() { + this._features = { + mutationObservers: true, + customElements: true, + slots: true, + steps: true + }; + this._window = null; + this._compareCache = new util_1.CompareCache(); + this._rangeList = new util_1.FixedSizeSet(); + } + /** + * Sets DOM algorithm features. + * + * @param features - DOM features supported by algorithms. All features are + * enabled by default unless explicity disabled. + */ + DOMImpl.prototype.setFeatures = function (features) { + if (features === undefined) + features = true; + if (util_1.isObject(features)) { + for (var key in features) { + this._features[key] = features[key] || false; + } + } + else { + // enable/disable all features + for (var key in this._features) { + this._features[key] = features; + } + } + }; + Object.defineProperty(DOMImpl.prototype, "features", { + /** + * Gets DOM algorithm features. + */ + get: function () { return this._features; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DOMImpl.prototype, "window", { + /** + * Gets the DOM window. + */ + get: function () { + if (this._window === null) { + this._window = CreateAlgorithm_1.create_window(); + } + return this._window; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DOMImpl.prototype, "compareCache", { + /** + * Gets the global node compare cache. + */ + get: function () { return this._compareCache; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DOMImpl.prototype, "rangeList", { + /** + * Gets the global range list. + */ + get: function () { return this._rangeList; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DOMImpl, "instance", { + /** + * Returns the instance of `DOM`. + */ + get: function () { + if (!DOMImpl._instance) { + DOMImpl._instance = new DOMImpl(); + } + return DOMImpl._instance; + }, + enumerable: true, + configurable: true + }); + return DOMImpl; +}()); +/** + * Represents an object implementing DOM algorithms. + */ +exports.dom = DOMImpl.instance; +//# sourceMappingURL=DOMImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/DOMImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/DOMImpl.js.map new file mode 100644 index 0000000..7223e03 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DOMImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DOMImpl.js","sourceRoot":"","sources":["../../src/dom/DOMImpl.ts"],"names":[],"mappings":";;AACA,uCAA2E;AAC3E,gEAA4D;AAU5D;;GAEG;AACH;IAaE;;OAEG;IACH;QAbQ,cAAS,GAAgB;YAC/B,iBAAiB,EAAE,IAAI;YACvB,cAAc,EAAE,IAAI;YACpB,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,IAAI;SACZ,CAAA;QACO,YAAO,GAAkB,IAAI,CAAA;QAQnC,IAAI,CAAC,aAAa,GAAG,IAAI,mBAAY,EAAQ,CAAA;QAC7C,IAAI,CAAC,UAAU,GAAG,IAAI,mBAAY,EAAS,CAAA;IAC7C,CAAC;IAED;;;;;OAKG;IACH,6BAAW,GAAX,UAAY,QAAyC;QACnD,IAAI,QAAQ,KAAK,SAAS;YAAE,QAAQ,GAAG,IAAI,CAAA;QAE3C,IAAI,eAAQ,CAAC,QAAQ,CAAC,EAAE;YACtB,KAAK,IAAM,GAAG,IAAI,QAAQ,EAAE;gBAC1B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAA;aAC7C;SACF;aAAM;YACL,8BAA8B;YAC9B,KAAK,IAAM,GAAG,IAAI,IAAI,CAAC,SAAS,EAAE;gBAChC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAA;aAC/B;SACF;IACH,CAAC;IAKD,sBAAI,6BAAQ;QAHZ;;WAEG;aACH,cAA8B,OAAO,IAAI,CAAC,SAAS,CAAA,CAAC,CAAC;;;OAAA;IAKrD,sBAAI,2BAAM;QAHV;;WAEG;aACH;YACE,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE;gBACzB,IAAI,CAAC,OAAO,GAAG,+BAAa,EAAE,CAAA;aAC/B;YACD,OAAO,IAAI,CAAC,OAAO,CAAA;QACrB,CAAC;;;OAAA;IAKD,sBAAI,iCAAY;QAHhB;;WAEG;aACH,cAAyC,OAAO,IAAI,CAAC,aAAa,CAAA,CAAC,CAAC;;;OAAA;IAKpE,sBAAI,8BAAS;QAHb;;WAEG;aACH,cAAuC,OAAO,IAAI,CAAC,UAAU,CAAA,CAAC,CAAC;;;OAAA;IAK/D,sBAAW,mBAAQ;QAHnB;;WAEG;aACH;YACE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;gBACtB,OAAO,CAAC,SAAS,GAAG,IAAI,OAAO,EAAE,CAAA;aAClC;YACD,OAAO,OAAO,CAAC,SAAS,CAAA;QAC1B,CAAC;;;OAAA;IACH,cAAC;AAAD,CAAC,AA5ED,IA4EC;AAED;;GAEG;AACU,QAAA,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAA"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/DOMImplementationImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/DOMImplementationImpl.d.ts new file mode 100644 index 0000000..70bd0ec --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DOMImplementationImpl.d.ts @@ -0,0 +1,29 @@ +import { DocumentType, Document, XMLDocument, DOMImplementation } from "./interfaces"; +/** + * Represents an object providing methods which are not dependent on + * any particular document. + */ +export declare class DOMImplementationImpl implements DOMImplementation { + _ID: string; + _associatedDocument: Document; + /** + * Initializes a new instance of `DOMImplementation`. + * + * @param document - the associated document + */ + constructor(document?: Document); + /** @inheritdoc */ + createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; + /** @inheritdoc */ + createDocument(namespace: string | null, qualifiedName: string, doctype?: DocumentType | null): XMLDocument; + /** @inheritdoc */ + createHTMLDocument(title?: string): Document; + /** @inheritdoc */ + hasFeature(): boolean; + /** + * Creates a new `DOMImplementation`. + * + * @param document - owner document + */ + static _create(document: Document): DOMImplementationImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/DOMImplementationImpl.js b/node_modules/@oozcitak/dom/lib/dom/DOMImplementationImpl.js new file mode 100644 index 0000000..b978f3f --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DOMImplementationImpl.js @@ -0,0 +1,149 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("./DOMImpl"); +var infra_1 = require("@oozcitak/infra"); +var algorithm_1 = require("../algorithm"); +var WebIDLAlgorithm_1 = require("../algorithm/WebIDLAlgorithm"); +/** + * Represents an object providing methods which are not dependent on + * any particular document. + */ +var DOMImplementationImpl = /** @class */ (function () { + /** + * Initializes a new instance of `DOMImplementation`. + * + * @param document - the associated document + */ + function DOMImplementationImpl(document) { + this._associatedDocument = document || DOMImpl_1.dom.window.document; + } + /** @inheritdoc */ + DOMImplementationImpl.prototype.createDocumentType = function (qualifiedName, publicId, systemId) { + /** + * 1. Validate qualifiedName. + * 2. Return a new doctype, with qualifiedName as its name, publicId as its + * public ID, and systemId as its system ID, and with its node document set + * to the associated document of the context object. + */ + algorithm_1.namespace_validate(qualifiedName); + return algorithm_1.create_documentType(this._associatedDocument, qualifiedName, publicId, systemId); + }; + /** @inheritdoc */ + DOMImplementationImpl.prototype.createDocument = function (namespace, qualifiedName, doctype) { + if (doctype === void 0) { doctype = null; } + /** + * 1. Let document be a new XMLDocument. + */ + var document = algorithm_1.create_xmlDocument(); + /** + * 2. Let element be null. + * 3. If qualifiedName is not the empty string, then set element to + * the result of running the internal createElementNS steps, given document, + * namespace, qualifiedName, and an empty dictionary. + */ + var element = null; + if (qualifiedName) { + element = algorithm_1.document_internalCreateElementNS(document, namespace, qualifiedName); + } + /** + * 4. If doctype is non-null, append doctype to document. + * 5. If element is non-null, append element to document. + */ + if (doctype) + document.appendChild(doctype); + if (element) + document.appendChild(element); + /** + * 6. document’s origin is context object’s associated document’s origin. + */ + document._origin = this._associatedDocument._origin; + /** + * 7. document’s content type is determined by namespace: + * - HTML namespace + * application/xhtml+xml + * - SVG namespace + * image/svg+xml + * - Any other namespace + * application/xml + */ + if (namespace === infra_1.namespace.HTML) + document._contentType = "application/xhtml+xml"; + else if (namespace === infra_1.namespace.SVG) + document._contentType = "image/svg+xml"; + else + document._contentType = "application/xml"; + /** + * 8. Return document. + */ + return document; + }; + /** @inheritdoc */ + DOMImplementationImpl.prototype.createHTMLDocument = function (title) { + /** + * 1. Let doc be a new document that is an HTML document. + * 2. Set doc’s content type to "text/html". + */ + var doc = algorithm_1.create_document(); + doc._type = "html"; + doc._contentType = "text/html"; + /** + * 3. Append a new doctype, with "html" as its name and with its node + * document set to doc, to doc. + */ + doc.appendChild(algorithm_1.create_documentType(doc, "html", "", "")); + /** + * 4. Append the result of creating an element given doc, html, and the + * HTML namespace, to doc. + */ + var htmlElement = algorithm_1.element_createAnElement(doc, "html", infra_1.namespace.HTML); + doc.appendChild(htmlElement); + /** + * 5. Append the result of creating an element given doc, head, and the + * HTML namespace, to the html element created earlier. + */ + var headElement = algorithm_1.element_createAnElement(doc, "head", infra_1.namespace.HTML); + htmlElement.appendChild(headElement); + /** + * 6. If title is given: + * 6.1. Append the result of creating an element given doc, title, and + * the HTML namespace, to the head element created earlier. + * 6.2. Append a new Text node, with its data set to title (which could + * be the empty string) and its node document set to doc, to the title + * element created earlier. + */ + if (title !== undefined) { + var titleElement = algorithm_1.element_createAnElement(doc, "title", infra_1.namespace.HTML); + headElement.appendChild(titleElement); + var textElement = algorithm_1.create_text(doc, title); + titleElement.appendChild(textElement); + } + /** + * 7. Append the result of creating an element given doc, body, and the + * HTML namespace, to the html element created earlier. + */ + var bodyElement = algorithm_1.element_createAnElement(doc, "body", infra_1.namespace.HTML); + htmlElement.appendChild(bodyElement); + /** + * 8. doc’s origin is context object’s associated document’s origin. + */ + doc._origin = this._associatedDocument._origin; + /** + * 9. Return doc. + */ + return doc; + }; + /** @inheritdoc */ + DOMImplementationImpl.prototype.hasFeature = function () { return true; }; + /** + * Creates a new `DOMImplementation`. + * + * @param document - owner document + */ + DOMImplementationImpl._create = function (document) { + return new DOMImplementationImpl(document); + }; + return DOMImplementationImpl; +}()); +exports.DOMImplementationImpl = DOMImplementationImpl; +WebIDLAlgorithm_1.idl_defineConst(DOMImplementationImpl.prototype, "_ID", "@oozcitak/dom"); +//# sourceMappingURL=DOMImplementationImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/DOMImplementationImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/DOMImplementationImpl.js.map new file mode 100644 index 0000000..84d13ea --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DOMImplementationImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DOMImplementationImpl.js","sourceRoot":"","sources":["../../src/dom/DOMImplementationImpl.ts"],"names":[],"mappings":";;AAAA,qCAA+B;AAI/B,yCAA6D;AAC7D,0CAGqB;AACrB,gEAA8D;AAE9D;;;GAGG;AACH;IAKE;;;;OAIG;IACH,+BAAY,QAAmB;QAC7B,IAAI,CAAC,mBAAmB,GAAG,QAAQ,IAAI,aAAG,CAAC,MAAM,CAAC,QAAQ,CAAA;IAC5D,CAAC;IAED,kBAAkB;IAClB,kDAAkB,GAAlB,UAAmB,aAAqB,EACtC,QAAgB,EAAE,QAAgB;QAClC;;;;;WAKG;QACH,8BAAkB,CAAC,aAAa,CAAC,CAAA;QAEjC,OAAO,+BAAmB,CAAC,IAAI,CAAC,mBAAmB,EACjD,aAAa,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IACtC,CAAC;IAED,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ozcitak/dom/lib/dom/DOMTokenListImpl.d.ts new file mode 100644 index 0000000..106755f --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DOMTokenListImpl.d.ts @@ -0,0 +1,46 @@ +import { DOMTokenList, Element, Attr } from "./interfaces"; +/** + * Represents a token set. + */ +export declare class DOMTokenListImpl implements DOMTokenList { + _element: Element; + _attribute: Attr; + _tokenSet: Set; + /** + * Initializes a new instance of `DOMTokenList`. + * + * @param element - associated element + * @param attribute - associated attribute + */ + private constructor(); + /** @inheritdoc */ + get length(): number; + /** @inheritdoc */ + item(index: number): string | null; + /** @inheritdoc */ + contains(token: string): boolean; + /** @inheritdoc */ + add(...tokens: string[]): void; + /** @inheritdoc */ + remove(...tokens: string[]): void; + /** @inheritdoc */ + toggle(token: string, force?: boolean | undefined): boolean; + /** @inheritdoc */ + replace(token: string, newToken: string): boolean; + /** @inheritdoc */ + supports(token: string): boolean; + /** @inheritdoc */ + get value(): string; + set value(value: string); + /** + * Returns an iterator for the token set. + */ + [Symbol.iterator](): Iterator; + /** + * Creates a new `DOMTokenList`. + * + * @param element - associated element + * @param attribute - associated attribute + */ + static _create(element: Element, attribute: Attr): DOMTokenListImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/DOMTokenListImpl.js b/node_modules/@oozcitak/dom/lib/dom/DOMTokenListImpl.js new file mode 100644 index 0000000..10ef75e --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DOMTokenListImpl.js @@ -0,0 +1,312 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("./DOMImpl"); +var DOMException_1 = require("./DOMException"); +var infra_1 = require("@oozcitak/infra"); +var algorithm_1 = require("../algorithm"); +/** + * Represents a token set. + */ +var DOMTokenListImpl = /** @class */ (function () { + /** + * Initializes a new instance of `DOMTokenList`. + * + * @param element - associated element + * @param attribute - associated attribute + */ + function DOMTokenListImpl(element, attribute) { + /** + * 1. Let element be associated element. + * 2. Let localName be associated attribute’s local name. + * 3. Let value be the result of getting an attribute value given element + * and localName. + * 4. Run the attribute change steps for element, localName, value, value, + * and null. + */ + this._element = element; + this._attribute = attribute; + this._tokenSet = new Set(); + var localName = attribute._localName; + var value = algorithm_1.element_getAnAttributeValue(element, localName); + // define a closure to be called when the associated attribute's value changes + var thisObj = this; + function updateTokenSet(element, localName, oldValue, value, namespace) { + /** + * 1. If localName is associated attribute’s local name, namespace is null, + * and value is null, then empty token set. + * 2. Otherwise, if localName is associated attribute’s local name, + * namespace is null, then set token set to value, parsed. + */ + if (localName === thisObj._attribute._localName && namespace === null) { + if (!value) + thisObj._tokenSet.clear(); + else + thisObj._tokenSet = algorithm_1.orderedSet_parse(value); + } + } + // add the closure to the associated element's attribute change steps + this._element._attributeChangeSteps.push(updateTokenSet); + if (DOMImpl_1.dom.features.steps) { + algorithm_1.dom_runAttributeChangeSteps(element, localName, value, value, null); + } + } + Object.defineProperty(DOMTokenListImpl.prototype, "length", { + /** @inheritdoc */ + get: function () { + /** + * The length attribute' getter must return context object’s token set’s + * size. + */ + return this._tokenSet.size; + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + DOMTokenListImpl.prototype.item = function (index) { + var e_1, _a; + /** + * 1. If index is equal to or greater than context object’s token set’s + * size, then return null. + * 2. Return context object’s token set[index]. + */ + var i = 0; + try { + for (var _b = __values(this._tokenSet), _c = _b.next(); !_c.done; _c = _b.next()) { + var token = _c.value; + if (i === index) + return token; + i++; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + return null; + }; + /** @inheritdoc */ + DOMTokenListImpl.prototype.contains = function (token) { + /** + * The contains(token) method, when invoked, must return true if context + * object’s token set[token] exists, and false otherwise. + */ + return this._tokenSet.has(token); + }; + /** @inheritdoc */ + DOMTokenListImpl.prototype.add = function () { + var e_2, _a; + var tokens = []; + for (var _i = 0; _i < arguments.length; _i++) { + tokens[_i] = arguments[_i]; + } + try { + /** + * 1. For each token in tokens: + * 1.1. If token is the empty string, then throw a "SyntaxError" + * DOMException. + * 1.2. If token contains any ASCII whitespace, then throw an + * "InvalidCharacterError" DOMException. + * 2. For each token in tokens, append token to context object’s token set. + * 3. Run the update steps. + */ + for (var tokens_1 = __values(tokens), tokens_1_1 = tokens_1.next(); !tokens_1_1.done; tokens_1_1 = tokens_1.next()) { + var token = tokens_1_1.value; + if (token === '') { + throw new DOMException_1.SyntaxError("Cannot add an empty token."); + } + else if (infra_1.codePoint.ASCIIWhiteSpace.test(token)) { + throw new DOMException_1.InvalidCharacterError("Token cannot contain whitespace."); + } + else { + this._tokenSet.add(token); + } + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (tokens_1_1 && !tokens_1_1.done && (_a = tokens_1.return)) _a.call(tokens_1); + } + finally { if (e_2) throw e_2.error; } + } + algorithm_1.tokenList_updateSteps(this); + }; + /** @inheritdoc */ + DOMTokenListImpl.prototype.remove = function () { + var e_3, _a; + var tokens = []; + for (var _i = 0; _i < arguments.length; _i++) { + tokens[_i] = arguments[_i]; + } + try { + /** + * 1. For each token in tokens: + * 1.1. If token is the empty string, then throw a "SyntaxError" + * DOMException. + * 1.2. If token contains any ASCII whitespace, then throw an + * "InvalidCharacterError" DOMException. + * 2. For each token in tokens, remove token from context object’s token set. + * 3. Run the update steps. + */ + for (var tokens_2 = __values(tokens), tokens_2_1 = tokens_2.next(); !tokens_2_1.done; tokens_2_1 = tokens_2.next()) { + var token = tokens_2_1.value; + if (token === '') { + throw new DOMException_1.SyntaxError("Cannot remove an empty token."); + } + else if (infra_1.codePoint.ASCIIWhiteSpace.test(token)) { + throw new DOMException_1.InvalidCharacterError("Token cannot contain whitespace."); + } + else { + this._tokenSet.delete(token); + } + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (tokens_2_1 && !tokens_2_1.done && (_a = tokens_2.return)) _a.call(tokens_2); + } + finally { if (e_3) throw e_3.error; } + } + algorithm_1.tokenList_updateSteps(this); + }; + /** @inheritdoc */ + DOMTokenListImpl.prototype.toggle = function (token, force) { + if (force === void 0) { force = undefined; } + /** + * 1. If token is the empty string, then throw a "SyntaxError" DOMException. + * 2. If token contains any ASCII whitespace, then throw an + * "InvalidCharacterError" DOMException. + */ + if (token === '') { + throw new DOMException_1.SyntaxError("Cannot toggle an empty token."); + } + else if (infra_1.codePoint.ASCIIWhiteSpace.test(token)) { + throw new DOMException_1.InvalidCharacterError("Token cannot contain whitespace."); + } + /** + * 3. If context object’s token set[token] exists, then: + */ + if (this._tokenSet.has(token)) { + /** + * 3.1. If force is either not given or is false, then remove token from + * context object’s token set, run the update steps and return false. + * 3.2. Return true. + */ + if (force === undefined || force === false) { + this._tokenSet.delete(token); + algorithm_1.tokenList_updateSteps(this); + return false; + } + return true; + } + /** + * 4. Otherwise, if force not given or is true, append token to context + * object’s token set, run the update steps, and return true. + */ + if (force === undefined || force === true) { + this._tokenSet.add(token); + algorithm_1.tokenList_updateSteps(this); + return true; + } + /** + * 5. Return false. + */ + return false; + }; + /** @inheritdoc */ + DOMTokenListImpl.prototype.replace = function (token, newToken) { + /** + * 1. If either token or newToken is the empty string, then throw a + * "SyntaxError" DOMException. + * 2. If either token or newToken contains any ASCII whitespace, then throw + * an "InvalidCharacterError" DOMException. + */ + if (token === '' || newToken === '') { + throw new DOMException_1.SyntaxError("Cannot replace an empty token."); + } + else if (infra_1.codePoint.ASCIIWhiteSpace.test(token) || infra_1.codePoint.ASCIIWhiteSpace.test(newToken)) { + throw new DOMException_1.InvalidCharacterError("Token cannot contain whitespace."); + } + /** + * 3. If context object’s token set does not contain token, then return + * false. + */ + if (!this._tokenSet.has(token)) + return false; + /** + * 4. Replace token in context object’s token set with newToken. + * 5. Run the update steps. + * 6. Return true. + */ + infra_1.set.replace(this._tokenSet, token, newToken); + algorithm_1.tokenList_updateSteps(this); + return true; + }; + /** @inheritdoc */ + DOMTokenListImpl.prototype.supports = function (token) { + /** + * 1. Let result be the return value of validation steps called with token. + * 2. Return result. + */ + return algorithm_1.tokenList_validationSteps(this, token); + }; + Object.defineProperty(DOMTokenListImpl.prototype, "value", { + /** @inheritdoc */ + get: function () { + /** + * The value attribute must return the result of running context object’s + * serialize steps. + */ + return algorithm_1.tokenList_serializeSteps(this); + }, + set: function (value) { + /** + * Setting the value attribute must set an attribute value for the + * associated element using associated attribute’s local name and the given + * value. + */ + algorithm_1.element_setAnAttributeValue(this._element, this._attribute._localName, value); + }, + enumerable: true, + configurable: true + }); + /** + * Returns an iterator for the token set. + */ + DOMTokenListImpl.prototype[Symbol.iterator] = function () { + var it = this._tokenSet[Symbol.iterator](); + return { + next: function () { + return it.next(); + } + }; + }; + /** + * Creates a new `DOMTokenList`. + * + * @param element - associated element + * @param attribute - associated attribute + */ + DOMTokenListImpl._create = function (element, attribute) { + return new DOMTokenListImpl(element, attribute); + }; + return DOMTokenListImpl; +}()); +exports.DOMTokenListImpl = DOMTokenListImpl; +//# sourceMappingURL=DOMTokenListImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/DOMTokenListImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/DOMTokenListImpl.js.map new file mode 100644 index 0000000..251ac11 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DOMTokenListImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DOMTokenListImpl.js","sourceRoot":"","sources":["../../src/dom/DOMTokenListImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAA+B;AAC/B,+CAAmE;AAEnE,yCAA8E;AAC9E,0CAIqB;AAErB;;GAEG;AACH;IAME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AgB,EAAE,SAAe;QAC9C,OAAO,IAAI,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IACjD,CAAC;IAEH,uBAAC;AAAD,CAAC,AApQD,IAoQC;AApQY,4CAAgB"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/DocumentFragmentImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/DocumentFragmentImpl.d.ts new file mode 100644 index 0000000..ad8b694 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DocumentFragmentImpl.d.ts @@ -0,0 +1,32 @@ +import { Node, Element, NodeType, HTMLCollection, NodeList, DocumentFragment, Document } from "./interfaces"; +import { NodeImpl } from "./NodeImpl"; +/** + * Represents a document fragment in the XML tree. + */ +export declare class DocumentFragmentImpl extends NodeImpl implements DocumentFragment { + _nodeType: NodeType; + _children: Set; + _host: Element | null; + /** + * Initializes a new instance of `DocumentFragment`. + * + * @param host - shadow root's host element + */ + constructor(host?: Element | null); + getElementById(elementId: string): Element | null; + get children(): HTMLCollection; + get firstElementChild(): Element | null; + get lastElementChild(): Element | null; + get childElementCount(): number; + prepend(...nodes: (Node | string)[]): void; + append(...nodes: (Node | string)[]): void; + querySelector(selectors: string): Element | null; + querySelectorAll(selectors: string): NodeList; + /** + * Creates a new `DocumentFragment`. + * + * @param document - owner document + * @param host - shadow root's host element + */ + static _create(document: Document, host?: Element | null): DocumentFragmentImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/DocumentFragmentImpl.js b/node_modules/@oozcitak/dom/lib/dom/DocumentFragmentImpl.js new file mode 100644 index 0000000..852d87f --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DocumentFragmentImpl.js @@ -0,0 +1,103 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("./interfaces"); +var NodeImpl_1 = require("./NodeImpl"); +var WebIDLAlgorithm_1 = require("../algorithm/WebIDLAlgorithm"); +/** + * Represents a document fragment in the XML tree. + */ +var DocumentFragmentImpl = /** @class */ (function (_super) { + __extends(DocumentFragmentImpl, _super); + /** + * Initializes a new instance of `DocumentFragment`. + * + * @param host - shadow root's host element + */ + function DocumentFragmentImpl(host) { + if (host === void 0) { host = null; } + var _this = _super.call(this) || this; + _this._children = new Set(); + _this._host = host; + return _this; + } + // MIXIN: NonElementParentNode + /* istanbul ignore next */ + DocumentFragmentImpl.prototype.getElementById = function (elementId) { throw new Error("Mixin: NonElementParentNode not implemented."); }; + Object.defineProperty(DocumentFragmentImpl.prototype, "children", { + // MIXIN: ParentNode + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentFragmentImpl.prototype, "firstElementChild", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentFragmentImpl.prototype, "lastElementChild", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentFragmentImpl.prototype, "childElementCount", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + /* istanbul ignore next */ + DocumentFragmentImpl.prototype.prepend = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ParentNode not implemented."); + }; + /* istanbul ignore next */ + DocumentFragmentImpl.prototype.append = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ParentNode not implemented."); + }; + /* istanbul ignore next */ + DocumentFragmentImpl.prototype.querySelector = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; + /* istanbul ignore next */ + DocumentFragmentImpl.prototype.querySelectorAll = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; + /** + * Creates a new `DocumentFragment`. + * + * @param document - owner document + * @param host - shadow root's host element + */ + DocumentFragmentImpl._create = function (document, host) { + if (host === void 0) { host = null; } + var node = new DocumentFragmentImpl(host); + node._nodeDocument = document; + return node; + }; + return DocumentFragmentImpl; +}(NodeImpl_1.NodeImpl)); +exports.DocumentFragmentImpl = DocumentFragmentImpl; +/** + * Initialize prototype properties + */ +WebIDLAlgorithm_1.idl_defineConst(DocumentFragmentImpl.prototype, "_nodeType", interfaces_1.NodeType.DocumentFragment); +//# sourceMappingURL=DocumentFragmentImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/DocumentFragmentImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/DocumentFragmentImpl.js.map new file mode 100644 index 0000000..ae0cedd --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DocumentFragmentImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DocumentFragmentImpl.js","sourceRoot":"","sources":["../../src/dom/DocumentFragmentImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAEqB;AACrB,uCAAqC;AACrC,gEAA8D;AAE9D;;GAEG;AACH;IAA0C,wCAAQ;IAOhD;;;;OAIG;IACH,8BAAmB,IAA2B;QAA3B,qBAAA,EAAA,WAA2B;QAA9C,YACE,iBAAO,SAGR;QAbD,eAAS,GAAc,IAAI,GAAG,EAAQ,CAAA;QAYpC,KAAI,CAAC,KAAK,GAAG,IAAI,CAAA;;IACnB,CAAC;IAED,8BAA8B;IAC9B,0BAA0B;IAC1B,6CAAc,GAAd,UAAe,SAAi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AG,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAA;QAC3C,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAA;QAC7B,OAAO,IAAI,CAAA;IACb,CAAC;IAEH,2BAAC;AAAD,CAAC,AArDD,CAA0C,mBAAQ,GAqDjD;AArDY,oDAAoB;AAuDjC;;GAEG;AACH,iCAAe,CAAC,oBAAoB,CAAC,SAAS,EAAE,WAAW,EAAE,qBAAQ,CAAC,gBAAgB,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/DocumentImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/DocumentImpl.d.ts new file mode 100644 index 0000000..e395ea1 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DocumentImpl.d.ts @@ -0,0 +1,116 @@ +import { DOMImplementation, DocumentType, Element, Text, NodeFilter, NodeType, Node, HTMLCollection, DocumentFragment, NodeList, WhatToShow, Attr, ProcessingInstruction, Comment, CDATASection, NodeIterator, TreeWalker, FilterResult, Range, Event, EventTarget, Document } from "./interfaces"; +import { NodeImpl } from "./NodeImpl"; +/** + * Represents a document node. + */ +export declare class DocumentImpl extends NodeImpl implements Document { + _nodeType: NodeType; + _children: Set; + _encoding: { + name: string; + labels: string[]; + }; + _contentType: string; + _URL: { + scheme: string; + username: string; + password: string; + host: null; + port: null; + path: string[]; + query: null; + fragment: null; + _cannotBeABaseURLFlag: boolean; + _blobURLEntry: null; + }; + _origin: null; + _type: "xml" | "html"; + _mode: "no-quirks" | "quirks" | "limited-quirks"; + protected _implementation?: DOMImplementation; + _documentElement: null; + _hasNamespaces: boolean; + _nodeDocumentOverwrite: Document | null; + get _nodeDocument(): Document; + set _nodeDocument(val: Document); + /** + * Initializes a new instance of `Document`. + */ + constructor(); + /** @inheritdoc */ + get implementation(): DOMImplementation; + /** @inheritdoc */ + get URL(): string; + /** @inheritdoc */ + get documentURI(): string; + /** @inheritdoc */ + get origin(): string; + /** @inheritdoc */ + get compatMode(): string; + /** @inheritdoc */ + get characterSet(): string; + /** @inheritdoc */ + get charset(): string; + /** @inheritdoc */ + get inputEncoding(): string; + /** @inheritdoc */ + get contentType(): string; + /** @inheritdoc */ + get doctype(): DocumentType | null; + /** @inheritdoc */ + get documentElement(): Element | null; + /** @inheritdoc */ + getElementsByTagName(qualifiedName: string): HTMLCollection; + /** @inheritdoc */ + getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollection; + /** @inheritdoc */ + getElementsByClassName(classNames: string): HTMLCollection; + /** @inheritdoc */ + createElement(localName: string, options?: string | { + is: string; + }): Element; + /** @inheritdoc */ + createElementNS(namespace: string | null, qualifiedName: string, options?: string | { + is: string; + }): Element; + /** @inheritdoc */ + createDocumentFragment(): DocumentFragment; + /** @inheritdoc */ + createTextNode(data: string): Text; + /** @inheritdoc */ + createCDATASection(data: string): CDATASection; + /** @inheritdoc */ + createComment(data: string): Comment; + /** @inheritdoc */ + createProcessingInstruction(target: string, data: string): ProcessingInstruction; + /** @inheritdoc */ + importNode(node: Node, deep?: boolean): Node; + /** @inheritdoc */ + adoptNode(node: Node): Node; + /** @inheritdoc */ + createAttribute(localName: string): Attr; + /** @inheritdoc */ + createAttributeNS(namespace: string, qualifiedName: string): Attr; + /** @inheritdoc */ + createEvent(eventInterface: string): Event; + /** @inheritdoc */ + createRange(): Range; + /** @inheritdoc */ + createNodeIterator(root: Node, whatToShow?: WhatToShow, filter?: NodeFilter | ((node: Node) => FilterResult) | null): NodeIterator; + /** @inheritdoc */ + createTreeWalker(root: Node, whatToShow?: WhatToShow, filter?: NodeFilter | ((node: Node) => FilterResult) | null): TreeWalker; + /** + * Gets the parent event target for the given event. + * + * @param event - an event + */ + _getTheParent(event: Event): EventTarget | null; + getElementById(elementId: string): Element | null; + get children(): HTMLCollection; + get firstElementChild(): Element | null; + get lastElementChild(): Element | null; + get childElementCount(): number; + prepend(...nodes: (Node | string)[]): void; + append(...nodes: (Node | string)[]): void; + querySelector(selectors: string): Element | null; + querySelectorAll(selectors: string): NodeList; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/DocumentImpl.js b/node_modules/@oozcitak/dom/lib/dom/DocumentImpl.js new file mode 100644 index 0000000..148004e --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DocumentImpl.js @@ -0,0 +1,545 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("./DOMImpl"); +var interfaces_1 = require("./interfaces"); +var DOMException_1 = require("./DOMException"); +var NodeImpl_1 = require("./NodeImpl"); +var util_1 = require("../util"); +var util_2 = require("@oozcitak/util"); +var infra_1 = require("@oozcitak/infra"); +var URLAlgorithm_1 = require("@oozcitak/url/lib/URLAlgorithm"); +var algorithm_1 = require("../algorithm"); +var WebIDLAlgorithm_1 = require("../algorithm/WebIDLAlgorithm"); +/** + * Represents a document node. + */ +var DocumentImpl = /** @class */ (function (_super) { + __extends(DocumentImpl, _super); + /** + * Initializes a new instance of `Document`. + */ + function DocumentImpl() { + var _this = _super.call(this) || this; + _this._children = new Set(); + _this._encoding = { + name: "UTF-8", + labels: ["unicode-1-1-utf-8", "utf-8", "utf8"] + }; + _this._contentType = 'application/xml'; + _this._URL = { + scheme: "about", + username: "", + password: "", + host: null, + port: null, + path: ["blank"], + query: null, + fragment: null, + _cannotBeABaseURLFlag: true, + _blobURLEntry: null + }; + _this._origin = null; + _this._type = "xml"; + _this._mode = "no-quirks"; + _this._documentElement = null; + _this._hasNamespaces = false; + _this._nodeDocumentOverwrite = null; + return _this; + } + Object.defineProperty(DocumentImpl.prototype, "_nodeDocument", { + get: function () { return this._nodeDocumentOverwrite || this; }, + set: function (val) { this._nodeDocumentOverwrite = val; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "implementation", { + /** @inheritdoc */ + get: function () { + /** + * The implementation attribute’s getter must return the DOMImplementation + * object that is associated with the document. + */ + return this._implementation || (this._implementation = algorithm_1.create_domImplementation(this)); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "URL", { + /** @inheritdoc */ + get: function () { + /** + * The URL attribute’s getter and documentURI attribute’s getter must return + * the URL, serialized. + * See: https://url.spec.whatwg.org/#concept-url-serializer + */ + return URLAlgorithm_1.urlSerializer(this._URL); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "documentURI", { + /** @inheritdoc */ + get: function () { return this.URL; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "origin", { + /** @inheritdoc */ + get: function () { + return "null"; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "compatMode", { + /** @inheritdoc */ + get: function () { + /** + * The compatMode attribute’s getter must return "BackCompat" if context + * object’s mode is "quirks", and "CSS1Compat" otherwise. + */ + return this._mode === "quirks" ? "BackCompat" : "CSS1Compat"; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "characterSet", { + /** @inheritdoc */ + get: function () { + /** + * The characterSet attribute’s getter, charset attribute’s getter, and + * inputEncoding attribute’s getter, must return context object’s + * encoding’s name. + */ + return this._encoding.name; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "charset", { + /** @inheritdoc */ + get: function () { return this._encoding.name; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "inputEncoding", { + /** @inheritdoc */ + get: function () { return this._encoding.name; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "contentType", { + /** @inheritdoc */ + get: function () { + /** + * The contentType attribute’s getter must return the content type. + */ + return this._contentType; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "doctype", { + /** @inheritdoc */ + get: function () { + var e_1, _a; + try { + /** + * The doctype attribute’s getter must return the child of the document + * that is a doctype, and null otherwise. + */ + for (var _b = __values(this._children), _c = _b.next(); !_c.done; _c = _b.next()) { + var child = _c.value; + if (util_1.Guard.isDocumentTypeNode(child)) + return child; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "documentElement", { + /** @inheritdoc */ + get: function () { + /** + * The documentElement attribute’s getter must return the document element. + */ + return this._documentElement; + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + DocumentImpl.prototype.getElementsByTagName = function (qualifiedName) { + /** + * The getElementsByTagName(qualifiedName) method, when invoked, must return + * the list of elements with qualified name qualifiedName for the context object. + */ + return algorithm_1.node_listOfElementsWithQualifiedName(qualifiedName, this); + }; + /** @inheritdoc */ + DocumentImpl.prototype.getElementsByTagNameNS = function (namespace, localName) { + /** + * The getElementsByTagNameNS(namespace, localName) method, when invoked, + * must return the list of elements with namespace namespace and local name + * localName for the context object. + */ + return algorithm_1.node_listOfElementsWithNamespace(namespace, localName, this); + }; + /** @inheritdoc */ + DocumentImpl.prototype.getElementsByClassName = function (classNames) { + /** + * The getElementsByClassName(classNames) method, when invoked, must return + * the list of elements with class names classNames for the context object. + */ + return algorithm_1.node_listOfElementsWithClassNames(classNames, this); + }; + /** @inheritdoc */ + DocumentImpl.prototype.createElement = function (localName, options) { + /** + * 1. If localName does not match the Name production, then throw an + * "InvalidCharacterError" DOMException. + * 2. If the context object is an HTML document, then set localName to + * localName in ASCII lowercase. + * 3. Let is be null. + * 4. If options is a dictionary and options’s is is present, then set is + * to it. + * 5. Let namespace be the HTML namespace, if the context object is an + * HTML document or context object’s content type is + * "application/xhtml+xml", and null otherwise. + * 6. Return the result of creating an element given the context object, + * localName, namespace, null, is, and with the synchronous custom elements + * flag set. + */ + if (!algorithm_1.xml_isName(localName)) + throw new DOMException_1.InvalidCharacterError(); + if (this._type === "html") + localName = localName.toLowerCase(); + var is = null; + if (options !== undefined) { + if (util_2.isString(options)) { + is = options; + } + else { + is = options.is; + } + } + var namespace = (this._type === "html" || this._contentType === "application/xhtml+xml") ? + infra_1.namespace.HTML : null; + return algorithm_1.element_createAnElement(this, localName, namespace, null, is, true); + }; + /** @inheritdoc */ + DocumentImpl.prototype.createElementNS = function (namespace, qualifiedName, options) { + /** + * The createElementNS(namespace, qualifiedName, options) method, when + * invoked, must return the result of running the internal createElementNS + * steps, given context object, namespace, qualifiedName, and options. + */ + return algorithm_1.document_internalCreateElementNS(this, namespace, qualifiedName, options); + }; + /** @inheritdoc */ + DocumentImpl.prototype.createDocumentFragment = function () { + /** + * The createDocumentFragment() method, when invoked, must return a new + * DocumentFragment node with its node document set to the context object. + */ + return algorithm_1.create_documentFragment(this); + }; + /** @inheritdoc */ + DocumentImpl.prototype.createTextNode = function (data) { + /** + * The createTextNode(data) method, when invoked, must return a new Text + * node with its data set to data and node document set to the context object. + */ + return algorithm_1.create_text(this, data); + }; + /** @inheritdoc */ + DocumentImpl.prototype.createCDATASection = function (data) { + /** + * 1. If context object is an HTML document, then throw a + * "NotSupportedError" DOMException. + * 2. If data contains the string "]]>", then throw an + * "InvalidCharacterError" DOMException. + * 3. Return a new CDATASection node with its data set to data and node + * document set to the context object. + */ + if (this._type === "html") + throw new DOMException_1.NotSupportedError(); + if (data.indexOf(']]>') !== -1) + throw new DOMException_1.InvalidCharacterError(); + return algorithm_1.create_cdataSection(this, data); + }; + /** @inheritdoc */ + DocumentImpl.prototype.createComment = function (data) { + /** + * The createComment(data) method, when invoked, must return a new Comment + * node with its data set to data and node document set to the context object. + */ + return algorithm_1.create_comment(this, data); + }; + /** @inheritdoc */ + DocumentImpl.prototype.createProcessingInstruction = function (target, data) { + /** + * 1. If target does not match the Name production, then throw an + * "InvalidCharacterError" DOMException. + * 2. If data contains the string "?>", then throw an + * "InvalidCharacterError" DOMException. + * 3. Return a new ProcessingInstruction node, with target set to target, + * data set to data, and node document set to the context object. + */ + if (!algorithm_1.xml_isName(target)) + throw new DOMException_1.InvalidCharacterError(); + if (data.indexOf("?>") !== -1) + throw new DOMException_1.InvalidCharacterError(); + return algorithm_1.create_processingInstruction(this, target, data); + }; + /** @inheritdoc */ + DocumentImpl.prototype.importNode = function (node, deep) { + if (deep === void 0) { deep = false; } + /** + * 1. If node is a document or shadow root, then throw a "NotSupportedError" DOMException. + */ + if (util_1.Guard.isDocumentNode(node) || util_1.Guard.isShadowRoot(node)) + throw new DOMException_1.NotSupportedError(); + /** + * 2. Return a clone of node, with context object and the clone children flag set if deep is true. + */ + return algorithm_1.node_clone(node, this, deep); + }; + /** @inheritdoc */ + DocumentImpl.prototype.adoptNode = function (node) { + /** + * 1. If node is a document, then throw a "NotSupportedError" DOMException. + */ + if (util_1.Guard.isDocumentNode(node)) + throw new DOMException_1.NotSupportedError(); + /** + * 2. If node is a shadow root, then throw a "HierarchyRequestError" DOMException. + */ + if (util_1.Guard.isShadowRoot(node)) + throw new DOMException_1.HierarchyRequestError(); + /** + * 3. Adopt node into the context object. + * 4. Return node. + */ + algorithm_1.document_adopt(node, this); + return node; + }; + /** @inheritdoc */ + DocumentImpl.prototype.createAttribute = function (localName) { + /** + * 1. If localName does not match the Name production in XML, then throw + * an "InvalidCharacterError" DOMException. + * 2. If the context object is an HTML document, then set localName to + * localName in ASCII lowercase. + * 3. Return a new attribute whose local name is localName and node document + * is context object. + */ + if (!algorithm_1.xml_isName(localName)) + throw new DOMException_1.InvalidCharacterError(); + if (this._type === "html") { + localName = localName.toLowerCase(); + } + var attr = algorithm_1.create_attr(this, localName); + return attr; + }; + /** @inheritdoc */ + DocumentImpl.prototype.createAttributeNS = function (namespace, qualifiedName) { + /** + * 1. Let namespace, prefix, and localName be the result of passing + * namespace and qualifiedName to validate and extract. + * 2. Return a new attribute whose namespace is namespace, namespace prefix + * is prefix, local name is localName, and node document is context object. + */ + var _a = __read(algorithm_1.namespace_validateAndExtract(namespace, qualifiedName), 3), ns = _a[0], prefix = _a[1], localName = _a[2]; + var attr = algorithm_1.create_attr(this, localName); + attr._namespace = ns; + attr._namespacePrefix = prefix; + return attr; + }; + /** @inheritdoc */ + DocumentImpl.prototype.createEvent = function (eventInterface) { + return algorithm_1.event_createLegacyEvent(eventInterface); + }; + /** @inheritdoc */ + DocumentImpl.prototype.createRange = function () { + /** + * The createRange() method, when invoked, must return a new live range + * with (context object, 0) as its start and end. + */ + var range = algorithm_1.create_range(); + range._start = [this, 0]; + range._end = [this, 0]; + return range; + }; + /** @inheritdoc */ + DocumentImpl.prototype.createNodeIterator = function (root, whatToShow, filter) { + if (whatToShow === void 0) { whatToShow = interfaces_1.WhatToShow.All; } + if (filter === void 0) { filter = null; } + /** + * 1. Let iterator be a new NodeIterator object. + * 2. Set iterator’s root and iterator’s reference to root. + * 3. Set iterator’s pointer before reference to true. + * 4. Set iterator’s whatToShow to whatToShow. + * 5. Set iterator’s filter to filter. + * 6. Return iterator. + */ + var iterator = algorithm_1.create_nodeIterator(root, root, true); + iterator._whatToShow = whatToShow; + iterator._iteratorCollection = algorithm_1.create_nodeList(root); + if (util_2.isFunction(filter)) { + iterator._filter = algorithm_1.create_nodeFilter(); + iterator._filter.acceptNode = filter; + } + else { + iterator._filter = filter; + } + return iterator; + }; + /** @inheritdoc */ + DocumentImpl.prototype.createTreeWalker = function (root, whatToShow, filter) { + if (whatToShow === void 0) { whatToShow = interfaces_1.WhatToShow.All; } + if (filter === void 0) { filter = null; } + /** + * 1. Let walker be a new TreeWalker object. + * 2. Set walker’s root and walker’s current to root. + * 3. Set walker’s whatToShow to whatToShow. + * 4. Set walker’s filter to filter. + * 5. Return walker. + */ + var walker = algorithm_1.create_treeWalker(root, root); + walker._whatToShow = whatToShow; + if (util_2.isFunction(filter)) { + walker._filter = algorithm_1.create_nodeFilter(); + walker._filter.acceptNode = filter; + } + else { + walker._filter = filter; + } + return walker; + }; + /** + * Gets the parent event target for the given event. + * + * @param event - an event + */ + DocumentImpl.prototype._getTheParent = function (event) { + /** + * TODO: Implement realms + * A document’s get the parent algorithm, given an event, returns null if + * event’s type attribute value is "load" or document does not have a + * browsing context, and the document’s relevant global object otherwise. + */ + if (event._type === "load") { + return null; + } + else { + return DOMImpl_1.dom.window; + } + }; + // MIXIN: NonElementParentNode + /* istanbul ignore next */ + DocumentImpl.prototype.getElementById = function (elementId) { throw new Error("Mixin: NonElementParentNode not implemented."); }; + Object.defineProperty(DocumentImpl.prototype, "children", { + // MIXIN: DocumentOrShadowRoot + // No elements + // MIXIN: ParentNode + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "firstElementChild", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "lastElementChild", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentImpl.prototype, "childElementCount", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + /* istanbul ignore next */ + DocumentImpl.prototype.prepend = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ParentNode not implemented."); + }; + /* istanbul ignore next */ + DocumentImpl.prototype.append = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ParentNode not implemented."); + }; + /* istanbul ignore next */ + DocumentImpl.prototype.querySelector = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; + /* istanbul ignore next */ + DocumentImpl.prototype.querySelectorAll = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; + return DocumentImpl; +}(NodeImpl_1.NodeImpl)); +exports.DocumentImpl = DocumentImpl; +/** + * Initialize prototype properties + */ +WebIDLAlgorithm_1.idl_defineConst(DocumentImpl.prototype, "_nodeType", interfaces_1.NodeType.Document); +//# sourceMappingURL=DocumentImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/DocumentImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/DocumentImpl.js.map new file mode 100644 index 0000000..26ed430 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DocumentImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DocumentImpl.js","sourceRoot":"","sources":["../../src/dom/DocumentImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAA+B;AAC/B,2CAKqB;AACrB,+CAEuB;AACvB,uCAAqC;AACrC,gCAA+B;AAC/B,uCAAqD;AACrD,yCAA6D;AAC7D,+DAA8D;AAC9D,0CASqB;AACrB,gEAA8D;AAE9D;;GAEG;AACH;IAAkC,gCAAQ;IAkCxC;;OAEG;IACH;QAAA,YACE,iBA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,6BAAM,GAAN;QAAO,eAA2B;aAA3B,UAA2B,EAA3B,qBAA2B,EAA3B,IAA2B;YAA3B,0BAA2B;;QAAU,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;IAAC,CAAC;IACnG,0BAA0B;IAC1B,oCAAa,GAAb,UAAc,SAAiB,IAAoB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA,CAAC,CAAC;IAC1G,0BAA0B;IAC1B,uCAAgB,GAAhB,UAAiB,SAAiB,IAAc,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA,CAAC,CAAC;IAEzG,mBAAC;AAAD,CAAC,AAjcD,CAAkC,mBAAQ,GAiczC;AAjcY,oCAAY;AAmczB;;GAEG;AACH,iCAAe,CAAC,YAAY,CAAC,SAAS,EAAE,WAAW,EAAE,qBAAQ,CAAC,QAAQ,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/DocumentOrShadowRootImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/DocumentOrShadowRootImpl.d.ts new file mode 100644 index 0000000..3fd1812 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DocumentOrShadowRootImpl.d.ts @@ -0,0 +1,11 @@ +import { DocumentOrShadowRoot } from "./interfaces"; +/** + * Represents a mixin for an interface to be used to share APIs between + * documents and shadow roots. This mixin is implemented by + * {@link Document} and {@link ShadowRoot}. + * + * _Note:_ The DocumentOrShadowRoot mixin is expected to be used by other + * standards that want to define APIs shared between documents and shadow roots. + */ +export declare class DocumentOrShadowRootImpl implements DocumentOrShadowRoot { +} diff --git a/node_modules/@oozcitak/dom/lib/dom/DocumentOrShadowRootImpl.js b/node_modules/@oozcitak/dom/lib/dom/DocumentOrShadowRootImpl.js new file mode 100644 index 0000000..1afff54 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DocumentOrShadowRootImpl.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Represents a mixin for an interface to be used to share APIs between + * documents and shadow roots. This mixin is implemented by + * {@link Document} and {@link ShadowRoot}. + * + * _Note:_ The DocumentOrShadowRoot mixin is expected to be used by other + * standards that want to define APIs shared between documents and shadow roots. + */ +var DocumentOrShadowRootImpl = /** @class */ (function () { + function DocumentOrShadowRootImpl() { + } + return DocumentOrShadowRootImpl; +}()); +exports.DocumentOrShadowRootImpl = DocumentOrShadowRootImpl; +//# sourceMappingURL=DocumentOrShadowRootImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/DocumentOrShadowRootImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/DocumentOrShadowRootImpl.js.map new file mode 100644 index 0000000..7f888b6 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DocumentOrShadowRootImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DocumentOrShadowRootImpl.js","sourceRoot":"","sources":["../../src/dom/DocumentOrShadowRootImpl.ts"],"names":[],"mappings":";;AAEA;;;;;;;GAOG;AACH;IAAA;IAEA,CAAC;IAAD,+BAAC;AAAD,CAAC,AAFD,IAEC;AAFY,4DAAwB"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/DocumentTypeImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/DocumentTypeImpl.d.ts new file mode 100644 index 0000000..6c709e9 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DocumentTypeImpl.d.ts @@ -0,0 +1,39 @@ +import { Node, NodeType, DocumentType, Document } from "./interfaces"; +import { NodeImpl } from "./NodeImpl"; +/** + * Represents an object providing methods which are not dependent on + * any particular document + */ +export declare class DocumentTypeImpl extends NodeImpl implements DocumentType { + _nodeType: NodeType; + _name: string; + _publicId: string; + _systemId: string; + /** + * Initializes a new instance of `DocumentType`. + * + * @param name - name of the node + * @param publicId - `PUBLIC` identifier + * @param systemId - `SYSTEM` identifier + */ + private constructor(); + /** @inheritdoc */ + get name(): string; + /** @inheritdoc */ + get publicId(): string; + /** @inheritdoc */ + get systemId(): string; + before(...nodes: (Node | string)[]): void; + after(...nodes: (Node | string)[]): void; + replaceWith(...nodes: (Node | string)[]): void; + remove(): void; + /** + * Creates a new `DocumentType`. + * + * @param document - owner document + * @param name - name of the node + * @param publicId - `PUBLIC` identifier + * @param systemId - `SYSTEM` identifier + */ + static _create(document: Document, name: string, publicId?: string, systemId?: string): DocumentTypeImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/DocumentTypeImpl.js b/node_modules/@oozcitak/dom/lib/dom/DocumentTypeImpl.js new file mode 100644 index 0000000..f105b16 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DocumentTypeImpl.js @@ -0,0 +1,109 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("./interfaces"); +var NodeImpl_1 = require("./NodeImpl"); +var WebIDLAlgorithm_1 = require("../algorithm/WebIDLAlgorithm"); +/** + * Represents an object providing methods which are not dependent on + * any particular document + */ +var DocumentTypeImpl = /** @class */ (function (_super) { + __extends(DocumentTypeImpl, _super); + /** + * Initializes a new instance of `DocumentType`. + * + * @param name - name of the node + * @param publicId - `PUBLIC` identifier + * @param systemId - `SYSTEM` identifier + */ + function DocumentTypeImpl(name, publicId, systemId) { + var _this = _super.call(this) || this; + _this._name = ''; + _this._publicId = ''; + _this._systemId = ''; + _this._name = name; + _this._publicId = publicId; + _this._systemId = systemId; + return _this; + } + Object.defineProperty(DocumentTypeImpl.prototype, "name", { + /** @inheritdoc */ + get: function () { return this._name; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentTypeImpl.prototype, "publicId", { + /** @inheritdoc */ + get: function () { return this._publicId; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DocumentTypeImpl.prototype, "systemId", { + /** @inheritdoc */ + get: function () { return this._systemId; }, + enumerable: true, + configurable: true + }); + // MIXIN: ChildNode + /* istanbul ignore next */ + DocumentTypeImpl.prototype.before = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); + }; + /* istanbul ignore next */ + DocumentTypeImpl.prototype.after = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); + }; + /* istanbul ignore next */ + DocumentTypeImpl.prototype.replaceWith = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); + }; + /* istanbul ignore next */ + DocumentTypeImpl.prototype.remove = function () { throw new Error("Mixin: ChildNode not implemented."); }; + /** + * Creates a new `DocumentType`. + * + * @param document - owner document + * @param name - name of the node + * @param publicId - `PUBLIC` identifier + * @param systemId - `SYSTEM` identifier + */ + DocumentTypeImpl._create = function (document, name, publicId, systemId) { + if (publicId === void 0) { publicId = ''; } + if (systemId === void 0) { systemId = ''; } + var node = new DocumentTypeImpl(name, publicId, systemId); + node._nodeDocument = document; + return node; + }; + return DocumentTypeImpl; +}(NodeImpl_1.NodeImpl)); +exports.DocumentTypeImpl = DocumentTypeImpl; +/** + * Initialize prototype properties + */ +WebIDLAlgorithm_1.idl_defineConst(DocumentTypeImpl.prototype, "_nodeType", interfaces_1.NodeType.DocumentType); +//# sourceMappingURL=DocumentTypeImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/DocumentTypeImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/DocumentTypeImpl.js.map new file mode 100644 index 0000000..88a3d7b --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/DocumentTypeImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DocumentTypeImpl.js","sourceRoot":"","sources":["../../src/dom/DocumentTypeImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAqE;AACrE,uCAAqC;AACrC,gEAA8D;AAE9D;;;GAGG;AACH;IAAsC,oCAAQ;IAQ5C;;;;;;OAMG;IACH,0BAAoB,IAAY,EAAE,QAAgB,EAAE,QAAgB;QAApE,YACE,iBAAO,SAKR;QAjBD,WAAK,GAAW,EAAE,CAAA;QAClB,eAAS,GAAW,EAAE,CAAA;QACtB,eAAS,GAAW,EAAE,CAAA;QAYpB,KAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,KAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;QACzB,KAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;;IAC3B,CAAC;IAGD,sBAAI,kCAAI;QADR,kBAAkB;aAClB,cAAqB,OAAO,IAAI,CAAC,KAAK,CAAA,CAAC,CAAC;;;OAAA;IAGxC,sBAAI,sCAAQ;QADZ,kBAAkB;aAClB,cAAyB,OAAO,IAAI,CAAC,SAAS,CAAA,CAAC,CAAC;;;OAAA;IAGhD,sBAAI,sCAAQ;QADZ,kBAAkB;aAClB,cAAyB,OAAO,IAAI,CAAC,SAAS,CAAA,CAAC,CAAC;;;OAAA;IAEhD,mBAAmB;IACnB,0BAA0B;IAC1B,iCAAM,GAAN;QAAO,eAA2B;aAA3B,UAA2B,EAA3B,qBAA2B,EAA3B,IAA2B;YAA3B,0BAA2B;;QAAU,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;IAAC,CAAC;IAClG,0BAA0B;IAC1B,gCAAK,GAAL;QAAM,eAA2B;aAA3B,UAA2B,EAA3B,qBAA2B,EAA3B,IAA2B;YAA3B,0BAA2B;;QAAU,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;IAAC,CAAC;IACjG,0BAA0B;IAC1B,sCAAW,GAAX;QAAY,eAA2B;aAA3B,UAA2B,EAA3B,qBAA2B,EAA3B,IAA2B;YAA3B,0BAA2B;;QAAU,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;IAAC,CAAC;IACvG,0BAA0B;IAC1B,iCAAM,GAAN,cAAiB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA,CAAC,CAAC;IAEvE;;;;;;;OAOG;IACI,wBAAO,GAAd,UAAe,QAAkB,EAAE,IAAY,EAAE,QAAqB,EACpE,QAAqB;QAD0B,yBAAA,EAAA,aAAqB;QACpE,yBAAA,EAAA,aAAqB;QACrB,IAAM,IAAI,GAAG,IAAI,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;QAC3D,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAA;QAC7B,OAAO,IAAI,CAAA;IACb,CAAC;IAEH,uBAAC;AAAD,CAAC,AAzDD,CAAsC,mBAAQ,GAyD7C;AAzDY,4CAAgB;AA2D7B;;GAEG;AACH,iCAAe,CAAC,gBAAgB,CAAC,SAAS,EAAE,WAAW,EAAE,qBAAQ,CAAC,YAAY,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/ElementImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/ElementImpl.d.ts new file mode 100644 index 0000000..09f92a5 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/ElementImpl.d.ts @@ -0,0 +1,132 @@ +import { Attr, NamedNodeMap, DOMTokenList, ShadowRoot, NodeType, Node, Document, Element, HTMLCollection, NodeList, ShadowRootMode, CustomElementDefinition, HTMLSlotElement, Slot, AttributeChangeStep } from "./interfaces"; +import { NodeImpl } from "./NodeImpl"; +/** + * Represents an element node. + */ +export declare class ElementImpl extends NodeImpl implements Element { + _nodeType: NodeType; + _children: Set; + _namespace: string | null; + _namespacePrefix: string | null; + _localName: string; + _customElementState: "undefined" | "failed" | "uncustomized" | "custom"; + _customElementDefinition: CustomElementDefinition | null; + _is: string | null; + _shadowRoot: ShadowRoot | null; + _attributeList: NamedNodeMap; + _uniqueIdentifier?: string; + _attributeChangeSteps: AttributeChangeStep[]; + _name: string; + _assignedSlot: Slot | null; + /** + * Initializes a new instance of `Element`. + */ + constructor(); + /** @inheritdoc */ + get namespaceURI(): string | null; + /** @inheritdoc */ + get prefix(): string | null; + /** @inheritdoc */ + get localName(): string; + /** @inheritdoc */ + get tagName(): string; + /** @inheritdoc */ + get id(): string; + set id(value: string); + /** @inheritdoc */ + get className(): string; + set className(value: string); + /** @inheritdoc */ + get classList(): DOMTokenList; + /** @inheritdoc */ + get slot(): string; + set slot(value: string); + /** @inheritdoc */ + hasAttributes(): boolean; + /** @inheritdoc */ + get attributes(): NamedNodeMap; + /** @inheritdoc */ + getAttributeNames(): string[]; + /** @inheritdoc */ + getAttribute(qualifiedName: string): string | null; + /** @inheritdoc */ + getAttributeNS(namespace: string, localName: string): string | null; + /** @inheritdoc */ + setAttribute(qualifiedName: string, value: string): void; + /** @inheritdoc */ + setAttributeNS(namespace: string, qualifiedName: string, value: string): void; + /** @inheritdoc */ + removeAttribute(qualifiedName: string): void; + /** @inheritdoc */ + removeAttributeNS(namespace: string, localName: string): void; + /** @inheritdoc */ + hasAttribute(qualifiedName: string): boolean; + /** @inheritdoc */ + toggleAttribute(qualifiedName: string, force?: boolean): boolean; + /** @inheritdoc */ + hasAttributeNS(namespace: string, localName: string): boolean; + /** @inheritdoc */ + getAttributeNode(qualifiedName: string): Attr | null; + /** @inheritdoc */ + getAttributeNodeNS(namespace: string, localName: string): Attr | null; + /** @inheritdoc */ + setAttributeNode(attr: Attr): Attr | null; + /** @inheritdoc */ + setAttributeNodeNS(attr: Attr): Attr | null; + /** @inheritdoc */ + removeAttributeNode(attr: Attr): Attr; + /** @inheritdoc */ + attachShadow(init: { + mode: ShadowRootMode; + }): ShadowRoot; + /** @inheritdoc */ + get shadowRoot(): ShadowRoot | null; + /** @inheritdoc */ + closest(selectors: string): Element | null; + /** @inheritdoc */ + matches(selectors: string): boolean; + /** @inheritdoc */ + webkitMatchesSelector(selectors: string): boolean; + /** @inheritdoc */ + getElementsByTagName(qualifiedName: string): HTMLCollection; + /** @inheritdoc */ + getElementsByTagNameNS(namespace: string, localName: string): HTMLCollection; + /** @inheritdoc */ + getElementsByClassName(classNames: string): HTMLCollection; + /** @inheritdoc */ + insertAdjacentElement(where: "beforebegin" | "afterbegin" | "beforeend" | "afterend", element: Element): Element | null; + /** @inheritdoc */ + insertAdjacentText(where: "beforebegin" | "afterbegin" | "beforeend" | "afterend", data: string): void; + /** + * Returns the qualified name. + */ + get _qualifiedName(): string; + /** + * Returns the upper-cased qualified name for a html element. + */ + get _htmlUppercasedQualifiedName(): string; + get children(): HTMLCollection; + get firstElementChild(): Element | null; + get lastElementChild(): Element | null; + get childElementCount(): number; + prepend(...nodes: (Node | string)[]): void; + append(...nodes: (Node | string)[]): void; + querySelector(selectors: string): Element | null; + querySelectorAll(selectors: string): NodeList; + get previousElementSibling(): Element | null; + get nextElementSibling(): Element | null; + before(...nodes: (Node | string)[]): void; + after(...nodes: (Node | string)[]): void; + replaceWith(...nodes: (Node | string)[]): void; + remove(): void; + get assignedSlot(): HTMLSlotElement | null; + /** + * Creates a new `Element`. + * + * @param document - owner document + * @param localName - local name + * @param namespace - namespace + * @param prefix - namespace prefix + */ + static _create(document: Document, localName: string, namespace?: string | null, namespacePrefix?: string | null): ElementImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/ElementImpl.js b/node_modules/@oozcitak/dom/lib/dom/ElementImpl.js new file mode 100644 index 0000000..29e9ac7 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/ElementImpl.js @@ -0,0 +1,714 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("./interfaces"); +var NodeImpl_1 = require("./NodeImpl"); +var DOMException_1 = require("./DOMException"); +var infra_1 = require("@oozcitak/infra"); +var algorithm_1 = require("../algorithm"); +var WebIDLAlgorithm_1 = require("../algorithm/WebIDLAlgorithm"); +/** + * Represents an element node. + */ +var ElementImpl = /** @class */ (function (_super) { + __extends(ElementImpl, _super); + /** + * Initializes a new instance of `Element`. + */ + function ElementImpl() { + var _this = _super.call(this) || this; + _this._children = new Set(); + _this._namespace = null; + _this._namespacePrefix = null; + _this._localName = ""; + _this._customElementState = "undefined"; + _this._customElementDefinition = null; + _this._is = null; + _this._shadowRoot = null; + _this._attributeList = algorithm_1.create_namedNodeMap(_this); + _this._attributeChangeSteps = []; + _this._name = ''; + _this._assignedSlot = null; + return _this; + } + Object.defineProperty(ElementImpl.prototype, "namespaceURI", { + /** @inheritdoc */ + get: function () { return this._namespace; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "prefix", { + /** @inheritdoc */ + get: function () { return this._namespacePrefix; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "localName", { + /** @inheritdoc */ + get: function () { return this._localName; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "tagName", { + /** @inheritdoc */ + get: function () { return this._htmlUppercasedQualifiedName; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "id", { + /** @inheritdoc */ + get: function () { + return algorithm_1.element_getAnAttributeValue(this, "id"); + }, + set: function (value) { + algorithm_1.element_setAnAttributeValue(this, "id", value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "className", { + /** @inheritdoc */ + get: function () { + return algorithm_1.element_getAnAttributeValue(this, "class"); + }, + set: function (value) { + algorithm_1.element_setAnAttributeValue(this, "class", value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "classList", { + /** @inheritdoc */ + get: function () { + var attr = algorithm_1.element_getAnAttributeByName("class", this); + if (attr === null) { + attr = algorithm_1.create_attr(this._nodeDocument, "class"); + } + return algorithm_1.create_domTokenList(this, attr); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "slot", { + /** @inheritdoc */ + get: function () { + return algorithm_1.element_getAnAttributeValue(this, "slot"); + }, + set: function (value) { + algorithm_1.element_setAnAttributeValue(this, "slot", value); + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + ElementImpl.prototype.hasAttributes = function () { + return this._attributeList.length !== 0; + }; + Object.defineProperty(ElementImpl.prototype, "attributes", { + /** @inheritdoc */ + get: function () { return this._attributeList; }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + ElementImpl.prototype.getAttributeNames = function () { + var e_1, _a; + /** + * The getAttributeNames() method, when invoked, must return the qualified + * names of the attributes in context object’s attribute list, in order, + * and a new list otherwise. + */ + var names = []; + try { + for (var _b = __values(this._attributeList), _c = _b.next(); !_c.done; _c = _b.next()) { + var attr = _c.value; + names.push(attr._qualifiedName); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + return names; + }; + /** @inheritdoc */ + ElementImpl.prototype.getAttribute = function (qualifiedName) { + /** + * 1. Let attr be the result of getting an attribute given qualifiedName + * and the context object. + * 2. If attr is null, return null. + * 3. Return attr’s value. + */ + var attr = algorithm_1.element_getAnAttributeByName(qualifiedName, this); + return (attr ? attr._value : null); + }; + /** @inheritdoc */ + ElementImpl.prototype.getAttributeNS = function (namespace, localName) { + /** + * 1. Let attr be the result of getting an attribute given namespace, + * localName, and the context object. + * 2. If attr is null, return null. + * 3. Return attr’s value. + */ + var attr = algorithm_1.element_getAnAttributeByNamespaceAndLocalName(namespace, localName, this); + return (attr ? attr._value : null); + }; + /** @inheritdoc */ + ElementImpl.prototype.setAttribute = function (qualifiedName, value) { + /** + * 1. If qualifiedName does not match the Name production in XML, then + * throw an "InvalidCharacterError" DOMException. + */ + if (!algorithm_1.xml_isName(qualifiedName)) + throw new DOMException_1.InvalidCharacterError(); + /** + * 2. If the context object is in the HTML namespace and its node document + * is an HTML document, then set qualifiedName to qualifiedName in ASCII + * lowercase. + */ + if (this._namespace === infra_1.namespace.HTML && this._nodeDocument._type === "html") { + qualifiedName = qualifiedName.toLowerCase(); + } + /** + * 3. Let attribute be the first attribute in context object’s attribute + * list whose qualified name is qualifiedName, and null otherwise. + */ + var attribute = null; + for (var i = 0; i < this._attributeList.length; i++) { + var attr = this._attributeList[i]; + if (attr._qualifiedName === qualifiedName) { + attribute = attr; + break; + } + } + /** + * 4. If attribute is null, create an attribute whose local name is + * qualifiedName, value is value, and node document is context object’s + * node document, then append this attribute to context object, and + * then return. + */ + if (attribute === null) { + attribute = algorithm_1.create_attr(this._nodeDocument, qualifiedName); + attribute._value = value; + algorithm_1.element_append(attribute, this); + return; + } + /** + * 5. Change attribute from context object to value. + */ + algorithm_1.element_change(attribute, this, value); + }; + /** @inheritdoc */ + ElementImpl.prototype.setAttributeNS = function (namespace, qualifiedName, value) { + /** + * 1. Let namespace, prefix, and localName be the result of passing + * namespace and qualifiedName to validate and extract. + * 2. Set an attribute value for the context object using localName, value, + * and also prefix and namespace. + */ + var _a = __read(algorithm_1.namespace_validateAndExtract(namespace, qualifiedName), 3), ns = _a[0], prefix = _a[1], localName = _a[2]; + algorithm_1.element_setAnAttributeValue(this, localName, value, prefix, ns); + }; + /** @inheritdoc */ + ElementImpl.prototype.removeAttribute = function (qualifiedName) { + /** + * The removeAttribute(qualifiedName) method, when invoked, must remove an + * attribute given qualifiedName and the context object, and then return + * undefined. + */ + algorithm_1.element_removeAnAttributeByName(qualifiedName, this); + }; + /** @inheritdoc */ + ElementImpl.prototype.removeAttributeNS = function (namespace, localName) { + /** + * The removeAttributeNS(namespace, localName) method, when invoked, must + * remove an attribute given namespace, localName, and context object, and + * then return undefined. + */ + algorithm_1.element_removeAnAttributeByNamespaceAndLocalName(namespace, localName, this); + }; + /** @inheritdoc */ + ElementImpl.prototype.hasAttribute = function (qualifiedName) { + /** + * 1. If the context object is in the HTML namespace and its node document + * is an HTML document, then set qualifiedName to qualifiedName in ASCII + * lowercase. + * 2. Return true if the context object has an attribute whose qualified + * name is qualifiedName, and false otherwise. + */ + if (this._namespace === infra_1.namespace.HTML && this._nodeDocument._type === "html") { + qualifiedName = qualifiedName.toLowerCase(); + } + for (var i = 0; i < this._attributeList.length; i++) { + var attr = this._attributeList[i]; + if (attr._qualifiedName === qualifiedName) { + return true; + } + } + return false; + }; + /** @inheritdoc */ + ElementImpl.prototype.toggleAttribute = function (qualifiedName, force) { + /** + * 1. If qualifiedName does not match the Name production in XML, then + * throw an "InvalidCharacterError" DOMException. + */ + if (!algorithm_1.xml_isName(qualifiedName)) + throw new DOMException_1.InvalidCharacterError(); + /** + * 2. If the context object is in the HTML namespace and its node document + * is an HTML document, then set qualifiedName to qualifiedName in ASCII + * lowercase. + */ + if (this._namespace === infra_1.namespace.HTML && this._nodeDocument._type === "html") { + qualifiedName = qualifiedName.toLowerCase(); + } + /** + * 3. Let attribute be the first attribute in the context object’s attribute + * list whose qualified name is qualifiedName, and null otherwise. + */ + var attribute = null; + for (var i = 0; i < this._attributeList.length; i++) { + var attr = this._attributeList[i]; + if (attr._qualifiedName === qualifiedName) { + attribute = attr; + break; + } + } + if (attribute === null) { + /** + * 4. If attribute is null, then: + * 4.1. If force is not given or is true, create an attribute whose local + * name is qualifiedName, value is the empty string, and node document is + * the context object’s node document, then append this attribute to the + * context object, and then return true. + * 4.2. Return false. + */ + if (force === undefined || force === true) { + attribute = algorithm_1.create_attr(this._nodeDocument, qualifiedName); + attribute._value = ''; + algorithm_1.element_append(attribute, this); + return true; + } + return false; + } + else if (force === undefined || force === false) { + /** + * 5. Otherwise, if force is not given or is false, remove an attribute + * given qualifiedName and the context object, and then return false. + */ + algorithm_1.element_removeAnAttributeByName(qualifiedName, this); + return false; + } + /** + * 6. Return true. + */ + return true; + }; + /** @inheritdoc */ + ElementImpl.prototype.hasAttributeNS = function (namespace, localName) { + /** + * 1. If namespace is the empty string, set it to null. + * 2. Return true if the context object has an attribute whose namespace is + * namespace and local name is localName, and false otherwise. + */ + var ns = namespace || null; + for (var i = 0; i < this._attributeList.length; i++) { + var attr = this._attributeList[i]; + if (attr._namespace === ns && attr._localName === localName) { + return true; + } + } + return false; + }; + /** @inheritdoc */ + ElementImpl.prototype.getAttributeNode = function (qualifiedName) { + /** + * The getAttributeNode(qualifiedName) method, when invoked, must return the + * result of getting an attribute given qualifiedName and context object. + */ + return algorithm_1.element_getAnAttributeByName(qualifiedName, this); + }; + /** @inheritdoc */ + ElementImpl.prototype.getAttributeNodeNS = function (namespace, localName) { + /** + * The getAttributeNodeNS(namespace, localName) method, when invoked, must + * return the result of getting an attribute given namespace, localName, and + * the context object. + */ + return algorithm_1.element_getAnAttributeByNamespaceAndLocalName(namespace, localName, this); + }; + /** @inheritdoc */ + ElementImpl.prototype.setAttributeNode = function (attr) { + /** + * The setAttributeNode(attr) and setAttributeNodeNS(attr) methods, when + * invoked, must return the result of setting an attribute given attr and + * the context object. + */ + return algorithm_1.element_setAnAttribute(attr, this); + }; + /** @inheritdoc */ + ElementImpl.prototype.setAttributeNodeNS = function (attr) { + return algorithm_1.element_setAnAttribute(attr, this); + }; + /** @inheritdoc */ + ElementImpl.prototype.removeAttributeNode = function (attr) { + /** + * 1. If context object’s attribute list does not contain attr, then throw + * a "NotFoundError" DOMException. + * 2. Remove attr from context object. + * 3. Return attr. + */ + var found = false; + for (var i = 0; i < this._attributeList.length; i++) { + var attribute = this._attributeList[i]; + if (attribute === attr) { + found = true; + break; + } + } + if (!found) + throw new DOMException_1.NotFoundError(); + algorithm_1.element_remove(attr, this); + return attr; + }; + /** @inheritdoc */ + ElementImpl.prototype.attachShadow = function (init) { + /** + * 1. If context object’s namespace is not the HTML namespace, then throw a + * "NotSupportedError" DOMException. + */ + if (this._namespace !== infra_1.namespace.HTML) + throw new DOMException_1.NotSupportedError(); + /** + * 2. If context object’s local name is not a valid custom element name, + * "article", "aside", "blockquote", "body", "div", "footer", "h1", "h2", + * "h3", "h4", "h5", "h6", "header", "main" "nav", "p", "section", + * or "span", then throw a "NotSupportedError" DOMException. + */ + if (!algorithm_1.customElement_isValidCustomElementName(this._localName) && + !algorithm_1.customElement_isValidShadowHostName(this._localName)) + throw new DOMException_1.NotSupportedError(); + /** + * 3. If context object’s local name is a valid custom element name, + * or context object’s is value is not null, then: + * 3.1. Let definition be the result of looking up a custom element + * definition given context object’s node document, its namespace, its + * local name, and its is value. + * 3.2. If definition is not null and definition’s disable shadow is true, + * then throw a "NotSupportedError" DOMException. + */ + if (algorithm_1.customElement_isValidCustomElementName(this._localName) || this._is !== null) { + var definition = algorithm_1.customElement_lookUpACustomElementDefinition(this._nodeDocument, this._namespace, this._localName, this._is); + if (definition !== null && definition.disableShadow === true) { + throw new DOMException_1.NotSupportedError(); + } + } + /** + * 4. If context object is a shadow host, then throw an "NotSupportedError" + * DOMException. + */ + if (this._shadowRoot !== null) + throw new DOMException_1.NotSupportedError(); + /** + * 5. Let shadow be a new shadow root whose node document is context + * object’s node document, host is context object, and mode is init’s mode. + * 6. Set context object’s shadow root to shadow. + * 7. Return shadow. + */ + var shadow = algorithm_1.create_shadowRoot(this._nodeDocument, this); + shadow._mode = init.mode; + this._shadowRoot = shadow; + return shadow; + }; + Object.defineProperty(ElementImpl.prototype, "shadowRoot", { + /** @inheritdoc */ + get: function () { + /** + * 1. Let shadow be context object’s shadow root. + * 2. If shadow is null or its mode is "closed", then return null. + * 3. Return shadow. + */ + var shadow = this._shadowRoot; + if (shadow === null || shadow.mode === "closed") + return null; + else + return shadow; + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + ElementImpl.prototype.closest = function (selectors) { + /** + * TODO: Selectors + * 1. Let s be the result of parse a selector from selectors. [SELECTORS4] + * 2. If s is failure, throw a "SyntaxError" DOMException. + * 3. Let elements be context object’s inclusive ancestors that are + * elements, in reverse tree order. + * 4. For each element in elements, if match a selector against an element, + * using s, element, and :scope element context object, returns success, + * return element. [SELECTORS4] + * 5. Return null. + */ + throw new DOMException_1.NotImplementedError(); + }; + /** @inheritdoc */ + ElementImpl.prototype.matches = function (selectors) { + /** + * TODO: Selectors + * 1. Let s be the result of parse a selector from selectors. [SELECTORS4] + * 2. If s is failure, throw a "SyntaxError" DOMException. + * 3. Return true if the result of match a selector against an element, + * using s, element, and :scope element context object, returns success, + * and false otherwise. [SELECTORS4] + */ + throw new DOMException_1.NotImplementedError(); + }; + /** @inheritdoc */ + ElementImpl.prototype.webkitMatchesSelector = function (selectors) { + return this.matches(selectors); + }; + /** @inheritdoc */ + ElementImpl.prototype.getElementsByTagName = function (qualifiedName) { + /** + * The getElementsByTagName(qualifiedName) method, when invoked, must return + * the list of elements with qualified name qualifiedName for context + * object. + */ + return algorithm_1.node_listOfElementsWithQualifiedName(qualifiedName, this); + }; + /** @inheritdoc */ + ElementImpl.prototype.getElementsByTagNameNS = function (namespace, localName) { + /** + * The getElementsByTagNameNS(namespace, localName) method, when invoked, + * must return the list of elements with namespace namespace and local name + * localName for context object. + */ + return algorithm_1.node_listOfElementsWithNamespace(namespace, localName, this); + }; + /** @inheritdoc */ + ElementImpl.prototype.getElementsByClassName = function (classNames) { + /** + * The getElementsByClassName(classNames) method, when invoked, must return + * the list of elements with class names classNames for context object. + */ + return algorithm_1.node_listOfElementsWithClassNames(classNames, this); + }; + /** @inheritdoc */ + ElementImpl.prototype.insertAdjacentElement = function (where, element) { + /** + * The insertAdjacentElement(where, element) method, when invoked, must + * return the result of running insert adjacent, given context object, + * where, and element. + */ + return algorithm_1.element_insertAdjacent(this, where, element); + }; + /** @inheritdoc */ + ElementImpl.prototype.insertAdjacentText = function (where, data) { + /** + * 1. Let text be a new Text node whose data is data and node document is + * context object’s node document. + * 2. Run insert adjacent, given context object, where, and text. + */ + var text = algorithm_1.create_text(this._nodeDocument, data); + algorithm_1.element_insertAdjacent(this, where, text); + }; + Object.defineProperty(ElementImpl.prototype, "_qualifiedName", { + /** + * Returns the qualified name. + */ + get: function () { + /** + * An element’s qualified name is its local name if its namespace prefix is + * null, and its namespace prefix, followed by ":", followed by its + * local name, otherwise. + */ + return (this._namespacePrefix ? + this._namespacePrefix + ':' + this._localName : + this._localName); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "_htmlUppercasedQualifiedName", { + /** + * Returns the upper-cased qualified name for a html element. + */ + get: function () { + /** + * 1. Let qualifiedName be context object’s qualified name. + * 2. If the context object is in the HTML namespace and its node document + * is an HTML document, then set qualifiedName to qualifiedName in ASCII + * uppercase. + * 3. Return qualifiedName. + */ + var qualifiedName = this._qualifiedName; + if (this._namespace === infra_1.namespace.HTML && this._nodeDocument._type === "html") { + qualifiedName = qualifiedName.toUpperCase(); + } + return qualifiedName; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "children", { + // MIXIN: ParentNode + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "firstElementChild", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "lastElementChild", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "childElementCount", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: ParentNode not implemented."); }, + enumerable: true, + configurable: true + }); + /* istanbul ignore next */ + ElementImpl.prototype.prepend = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ParentNode not implemented."); + }; + /* istanbul ignore next */ + ElementImpl.prototype.append = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ParentNode not implemented."); + }; + /* istanbul ignore next */ + ElementImpl.prototype.querySelector = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; + /* istanbul ignore next */ + ElementImpl.prototype.querySelectorAll = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; + Object.defineProperty(ElementImpl.prototype, "previousElementSibling", { + // MIXIN: NonDocumentTypeChildNode + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementImpl.prototype, "nextElementSibling", { + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); }, + enumerable: true, + configurable: true + }); + // MIXIN: ChildNode + /* istanbul ignore next */ + ElementImpl.prototype.before = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); + }; + /* istanbul ignore next */ + ElementImpl.prototype.after = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); + }; + /* istanbul ignore next */ + ElementImpl.prototype.replaceWith = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + throw new Error("Mixin: ChildNode not implemented."); + }; + /* istanbul ignore next */ + ElementImpl.prototype.remove = function () { throw new Error("Mixin: ChildNode not implemented."); }; + Object.defineProperty(ElementImpl.prototype, "assignedSlot", { + // MIXIN: Slotable + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: Slotable not implemented."); }, + enumerable: true, + configurable: true + }); + /** + * Creates a new `Element`. + * + * @param document - owner document + * @param localName - local name + * @param namespace - namespace + * @param prefix - namespace prefix + */ + ElementImpl._create = function (document, localName, namespace, namespacePrefix) { + if (namespace === void 0) { namespace = null; } + if (namespacePrefix === void 0) { namespacePrefix = null; } + var node = new ElementImpl(); + node._localName = localName; + node._namespace = namespace; + node._namespacePrefix = namespacePrefix; + node._nodeDocument = document; + return node; + }; + return ElementImpl; +}(NodeImpl_1.NodeImpl)); +exports.ElementImpl = ElementImpl; +/** + * Initialize prototype properties + */ +WebIDLAlgorithm_1.idl_defineConst(ElementImpl.prototype, "_nodeType", interfaces_1.NodeType.Element); +//# sourceMappingURL=ElementImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/ElementImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/ElementImpl.js.map new file mode 100644 index 0000000..829bef5 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/ElementImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ElementImpl.js","sourceRoot":"","sources":["../../src/dom/ElementImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAIqB;AACrB,u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Y,eAA2B;aAA3B,UAA2B,EAA3B,qBAA2B,EAA3B,IAA2B;YAA3B,0BAA2B;;QAAU,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;IAAC,CAAC;IACvG,0BAA0B;IAC1B,4BAAM,GAAN,cAAiB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA,CAAC,CAAC;IAIvE,sBAAI,qCAAY;QAFhB,kBAAkB;QAClB,0BAA0B;aAC1B,cAA6C,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAA,CAAC,CAAC;;;OAAA;IAElG;;;;;;;OAOG;IACI,mBAAO,GAAd,UAAe,QAAkB,EAAE,SAAiB,EAClD,SAA+B,EAC/B,eAAqC;QADrC,0BAAA,EAAA,gBAA+B;QAC/B,gCAAA,EAAA,sBAAqC;QAErC,IAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAA;QAC9B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;QAC3B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;QAC3B,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAA;QAEvC,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAA;QAC7B,OAAO,IAAI,CAAA;IACb,CAAC;IACH,kBAAC;AAAD,CAAC,AAvmBD,CAAiC,mBAAQ,GAumBxC;AAvmBY,kCAAW;AAymBxB;;GAEG;AACH,iCAAe,CAAC,WAAW,CAAC,SAAS,EAAE,WAAW,EAAE,qBAAQ,CAAC,OAAO,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/EventImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/EventImpl.d.ts new file mode 100644 index 0000000..879b7de --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/EventImpl.d.ts @@ -0,0 +1,74 @@ +import { EventInit, EventTarget, EventPhase, PotentialEventTarget, EventPathItem, Event } from "./interfaces"; +/** + * Represents a DOM event. + */ +export declare class EventImpl implements Event { + static NONE: number; + static CAPTURING_PHASE: number; + static AT_TARGET: number; + static BUBBLING_PHASE: number; + NONE: number; + CAPTURING_PHASE: number; + AT_TARGET: number; + BUBBLING_PHASE: number; + _target: PotentialEventTarget; + _relatedTarget: PotentialEventTarget; + _touchTargetList: PotentialEventTarget[]; + _path: EventPathItem[]; + _currentTarget: PotentialEventTarget; + _eventPhase: EventPhase; + _stopPropagationFlag: boolean; + _stopImmediatePropagationFlag: boolean; + _canceledFlag: boolean; + _inPassiveListenerFlag: boolean; + _composedFlag: boolean; + _initializedFlag: boolean; + _dispatchFlag: boolean; + _isTrusted: boolean; + _type: string; + _bubbles: boolean; + _cancelable: boolean; + _timeStamp: number; + /** + * Initializes a new instance of `Event`. + */ + constructor(type: string, eventInit?: EventInit); + /** @inheritdoc */ + get type(): string; + /** @inheritdoc */ + get target(): EventTarget | null; + /** @inheritdoc */ + get srcElement(): EventTarget | null; + /** @inheritdoc */ + get currentTarget(): EventTarget | null; + /** @inheritdoc */ + composedPath(): EventTarget[]; + /** @inheritdoc */ + get eventPhase(): EventPhase; + /** @inheritdoc */ + stopPropagation(): void; + /** @inheritdoc */ + get cancelBubble(): boolean; + set cancelBubble(value: boolean); + /** @inheritdoc */ + stopImmediatePropagation(): void; + /** @inheritdoc */ + get bubbles(): boolean; + /** @inheritdoc */ + get cancelable(): boolean; + /** @inheritdoc */ + get returnValue(): boolean; + set returnValue(value: boolean); + /** @inheritdoc */ + preventDefault(): void; + /** @inheritdoc */ + get defaultPrevented(): boolean; + /** @inheritdoc */ + get composed(): boolean; + /** @inheritdoc */ + get isTrusted(): boolean; + /** @inheritdoc */ + get timeStamp(): number; + /** @inheritdoc */ + initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/EventImpl.js b/node_modules/@oozcitak/dom/lib/dom/EventImpl.js new file mode 100644 index 0000000..cd53b66 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/EventImpl.js @@ -0,0 +1,313 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("./interfaces"); +var algorithm_1 = require("../algorithm"); +var WebIDLAlgorithm_1 = require("../algorithm/WebIDLAlgorithm"); +/** + * Represents a DOM event. + */ +var EventImpl = /** @class */ (function () { + /** + * Initializes a new instance of `Event`. + */ + function EventImpl(type, eventInit) { + this._target = null; + this._relatedTarget = null; + this._touchTargetList = []; + this._path = []; + this._currentTarget = null; + this._eventPhase = interfaces_1.EventPhase.None; + this._stopPropagationFlag = false; + this._stopImmediatePropagationFlag = false; + this._canceledFlag = false; + this._inPassiveListenerFlag = false; + this._composedFlag = false; + this._initializedFlag = false; + this._dispatchFlag = false; + this._isTrusted = false; + this._bubbles = false; + this._cancelable = false; + /** + * When a constructor of the Event interface, or of an interface that + * inherits from the Event interface, is invoked, these steps must be run, + * given the arguments type and eventInitDict: + * 1. Let event be the result of running the inner event creation steps with + * this interface, null, now, and eventInitDict. + * 2. Initialize event’s type attribute to type. + * 3. Return event. + */ + this._type = type; + if (eventInit) { + this._bubbles = eventInit.bubbles || false; + this._cancelable = eventInit.cancelable || false; + this._composedFlag = eventInit.composed || false; + } + this._initializedFlag = true; + this._timeStamp = new Date().getTime(); + } + Object.defineProperty(EventImpl.prototype, "type", { + /** @inheritdoc */ + get: function () { return this._type; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventImpl.prototype, "target", { + /** @inheritdoc */ + get: function () { return this._target; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventImpl.prototype, "srcElement", { + /** @inheritdoc */ + get: function () { return this._target; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventImpl.prototype, "currentTarget", { + /** @inheritdoc */ + get: function () { return this._currentTarget; }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + EventImpl.prototype.composedPath = function () { + /** + * 1. Let composedPath be an empty list. + * 2. Let path be the context object’s path. + * 3. If path is empty, then return composedPath. + * 4. Let currentTarget be the context object’s currentTarget attribute + * value. + * 5. Append currentTarget to composedPath. + * 6. Let currentTargetIndex be 0. + * 7. Let currentTargetHiddenSubtreeLevel be 0. + */ + var composedPath = []; + var path = this._path; + if (path.length === 0) + return composedPath; + var currentTarget = this._currentTarget; + if (currentTarget === null) { + throw new Error("Event currentTarget is null."); + } + composedPath.push(currentTarget); + var currentTargetIndex = 0; + var currentTargetHiddenSubtreeLevel = 0; + /** + * 8. Let index be path’s size − 1. + * 9. While index is greater than or equal to 0: + */ + var index = path.length - 1; + while (index >= 0) { + /** + * 9.1. If path[index]'s root-of-closed-tree is true, then increase + * currentTargetHiddenSubtreeLevel by 1. + * 9.2. If path[index]'s invocation target is currentTarget, then set + * currentTargetIndex to index and break. + * 9.3. If path[index]'s slot-in-closed-tree is true, then decrease + * currentTargetHiddenSubtreeLevel by 1. + * 9.4. Decrease index by 1. + */ + if (path[index].rootOfClosedTree) { + currentTargetHiddenSubtreeLevel++; + } + if (path[index].invocationTarget === currentTarget) { + currentTargetIndex = index; + break; + } + if (path[index].slotInClosedTree) { + currentTargetHiddenSubtreeLevel--; + } + index--; + } + /** + * 10. Let currentHiddenLevel and maxHiddenLevel be + * currentTargetHiddenSubtreeLevel. + */ + var currentHiddenLevel = currentTargetHiddenSubtreeLevel; + var maxHiddenLevel = currentTargetHiddenSubtreeLevel; + /** + * 11. Set index to currentTargetIndex − 1. + * 12. While index is greater than or equal to 0: + */ + index = currentTargetIndex - 1; + while (index >= 0) { + /** + * 12.1. If path[index]'s root-of-closed-tree is true, then increase + * currentHiddenLevel by 1. + * 12.2. If currentHiddenLevel is less than or equal to maxHiddenLevel, + * then prepend path[index]'s invocation target to composedPath. + */ + if (path[index].rootOfClosedTree) { + currentHiddenLevel++; + } + if (currentHiddenLevel <= maxHiddenLevel) { + composedPath.unshift(path[index].invocationTarget); + } + /** + * 12.3. If path[index]'s slot-in-closed-tree is true, then: + */ + if (path[index].slotInClosedTree) { + /** + * 12.3.1. Decrease currentHiddenLevel by 1. + * 12.3.2. If currentHiddenLevel is less than maxHiddenLevel, then set + * maxHiddenLevel to currentHiddenLevel. + */ + currentHiddenLevel--; + if (currentHiddenLevel < maxHiddenLevel) { + maxHiddenLevel = currentHiddenLevel; + } + } + /** + * 12.4. Decrease index by 1. + */ + index--; + } + /** + * 13. Set currentHiddenLevel and maxHiddenLevel to + * currentTargetHiddenSubtreeLevel. + */ + currentHiddenLevel = currentTargetHiddenSubtreeLevel; + maxHiddenLevel = currentTargetHiddenSubtreeLevel; + /** + * 14. Set index to currentTargetIndex + 1. + * 15. While index is less than path’s size: + */ + index = currentTargetIndex + 1; + while (index < path.length) { + /** + * 15.1. If path[index]'s slot-in-closed-tree is true, then increase + * currentHiddenLevel by 1. + * 15.2. If currentHiddenLevel is less than or equal to maxHiddenLevel, + * then append path[index]'s invocation target to composedPath. + */ + if (path[index].slotInClosedTree) { + currentHiddenLevel++; + } + if (currentHiddenLevel <= maxHiddenLevel) { + composedPath.push(path[index].invocationTarget); + } + /** + * 15.3. If path[index]'s root-of-closed-tree is true, then: + */ + if (path[index].rootOfClosedTree) { + /** + * 15.3.1. Decrease currentHiddenLevel by 1. + * 15.3.2. If currentHiddenLevel is less than maxHiddenLevel, then set + * maxHiddenLevel to currentHiddenLevel. + */ + currentHiddenLevel--; + if (currentHiddenLevel < maxHiddenLevel) { + maxHiddenLevel = currentHiddenLevel; + } + } + /** + * 15.4. Increase index by 1. + */ + index++; + } + /** + * 16. Return composedPath. + */ + return composedPath; + }; + Object.defineProperty(EventImpl.prototype, "eventPhase", { + /** @inheritdoc */ + get: function () { return this._eventPhase; }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + EventImpl.prototype.stopPropagation = function () { this._stopPropagationFlag = true; }; + Object.defineProperty(EventImpl.prototype, "cancelBubble", { + /** @inheritdoc */ + get: function () { return this._stopPropagationFlag; }, + set: function (value) { if (value) + this.stopPropagation(); }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + EventImpl.prototype.stopImmediatePropagation = function () { + this._stopPropagationFlag = true; + this._stopImmediatePropagationFlag = true; + }; + Object.defineProperty(EventImpl.prototype, "bubbles", { + /** @inheritdoc */ + get: function () { return this._bubbles; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventImpl.prototype, "cancelable", { + /** @inheritdoc */ + get: function () { return this._cancelable; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventImpl.prototype, "returnValue", { + /** @inheritdoc */ + get: function () { return !this._canceledFlag; }, + set: function (value) { + if (!value) { + algorithm_1.event_setTheCanceledFlag(this); + } + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + EventImpl.prototype.preventDefault = function () { + algorithm_1.event_setTheCanceledFlag(this); + }; + Object.defineProperty(EventImpl.prototype, "defaultPrevented", { + /** @inheritdoc */ + get: function () { return this._canceledFlag; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventImpl.prototype, "composed", { + /** @inheritdoc */ + get: function () { return this._composedFlag; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventImpl.prototype, "isTrusted", { + /** @inheritdoc */ + get: function () { return this._isTrusted; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventImpl.prototype, "timeStamp", { + /** @inheritdoc */ + get: function () { return this._timeStamp; }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + EventImpl.prototype.initEvent = function (type, bubbles, cancelable) { + if (bubbles === void 0) { bubbles = false; } + if (cancelable === void 0) { cancelable = false; } + /** + * 1. If the context object’s dispatch flag is set, then return. + */ + if (this._dispatchFlag) + return; + /** + * 2. Initialize the context object with type, bubbles, and cancelable. + */ + algorithm_1.event_initialize(this, type, bubbles, cancelable); + }; + EventImpl.NONE = 0; + EventImpl.CAPTURING_PHASE = 1; + EventImpl.AT_TARGET = 2; + EventImpl.BUBBLING_PHASE = 3; + return EventImpl; +}()); +exports.EventImpl = EventImpl; +/** + * Define constants on prototype. + */ +WebIDLAlgorithm_1.idl_defineConst(EventImpl.prototype, "NONE", 0); +WebIDLAlgorithm_1.idl_defineConst(EventImpl.prototype, "CAPTURING_PHASE", 1); +WebIDLAlgorithm_1.idl_defineConst(EventImpl.prototype, "AT_TARGET", 2); +WebIDLAlgorithm_1.idl_defineConst(EventImpl.prototype, "BUBBLING_PHASE", 3); +//# sourceMappingURL=EventImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/EventImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/EventImpl.js.map new file mode 100644 index 0000000..bc5a949 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/EventImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"EventImpl.js","sourceRoot":"","sources":["../../src/dom/EventImpl.ts"],"names":[],"mappings":";;AAAA,2CAEqB;AACrB,0CAAyE;AACzE,gEAA8D;AAE9D;;GAEG;AACH;IAkCE;;OAEG;IACH,mBAAmB,IAAY,EAAE,SAAqB;QAzBtD,YAAO,GAAyB,IAAI,CAAA;QACpC,mBAAc,GAAyB,IAAI,CAAA;QAC3C,qBAAgB,GAA2B,EAAE,CAAA;QAC7C,UAAK,GAAoB,EAAE,CAAA;QAC3B,mBAAc,GAAyB,IAAI,CAAA;QAC3C,gBAAW,GAAe,uBAAU,CAAC,IAAI,CAAA;QAEzC,yBAAoB,GAAY,KAAK,CAAA;QACrC,kCAA6B,GAAY,KAAK,CAAA;QAC9C,kBAAa,GAAY,KAAK,CAAA;QAC9B,2BAAsB,GAAY,KAAK,CAAA;QACvC,kBAAa,GAAY,KAAK,CAAA;QAC9B,qBAAgB,GAAY,KAAK,CAAA;QACjC,kBAAa,GAAY,KAAK,CAAA;QAE9B,eAAU,GAAY,KAAK,CAAA;QAG3B,aAAQ,GAAY,KAAK,CAAA;QACzB,gBAAW,GAAY,KAAK,CAAA;QAQ1B;;;;;;;;WAQG;QACH,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,SAAS,EAAE;YACb,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,IAAI,KAAK,CAAA;YAC1C,IA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AAS,EAAE,iBAAiB,EAAG,CAAC,CAAC,CAAA;AAC3D,iCAAe,CAAC,SAAS,CAAC,SAAS,EAAE,WAAW,EAAG,CAAC,CAAC,CAAA;AACrD,iCAAe,CAAC,SAAS,CAAC,SAAS,EAAE,gBAAgB,EAAG,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/EventTargetImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/EventTargetImpl.d.ts new file mode 100644 index 0000000..e60053f --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/EventTargetImpl.d.ts @@ -0,0 +1,30 @@ +import { Event, EventListener, EventTarget, AddEventListenerOptions, EventListenerOptions, EventListenerEntry, EventHandlerEntry } from "./interfaces"; +/** + * Represents a target to which an event can be dispatched. + */ +export declare abstract class EventTargetImpl implements EventTarget { + private __eventListenerList?; + get _eventListenerList(): EventListenerEntry[]; + private __eventHandlerMap?; + get _eventHandlerMap(): { + [key: string]: EventHandlerEntry; + }; + /** + * Initializes a new instance of `EventTarget`. + */ + constructor(); + /** @inheritdoc */ + addEventListener(type: string, callback: EventListener | null | ((event: Event) => void), options?: AddEventListenerOptions | boolean): void; + /** @inheritdoc */ + removeEventListener(type: string, callback: EventListener | null | ((event: Event) => void), options?: EventListenerOptions | boolean): void; + /** @inheritdoc */ + dispatchEvent(event: Event): boolean; + /** @inheritdoc */ + _getTheParent(event: Event): EventTarget | null; + /** @inheritdoc */ + _activationBehavior?(event: Event): void; + /** @inheritdoc */ + _legacyPreActivationBehavior?(event: Event): void; + /** @inheritdoc */ + _legacyCanceledActivationBehavior?(event: Event): void; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/EventTargetImpl.js b/node_modules/@oozcitak/dom/lib/dom/EventTargetImpl.js new file mode 100644 index 0000000..7d90baf --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/EventTargetImpl.js @@ -0,0 +1,133 @@ +"use strict"; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMException_1 = require("./DOMException"); +var util_1 = require("../util"); +var algorithm_1 = require("../algorithm"); +/** + * Represents a target to which an event can be dispatched. + */ +var EventTargetImpl = /** @class */ (function () { + /** + * Initializes a new instance of `EventTarget`. + */ + function EventTargetImpl() { + } + Object.defineProperty(EventTargetImpl.prototype, "_eventListenerList", { + get: function () { + return this.__eventListenerList || (this.__eventListenerList = []); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EventTargetImpl.prototype, "_eventHandlerMap", { + get: function () { + return this.__eventHandlerMap || (this.__eventHandlerMap = {}); + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + EventTargetImpl.prototype.addEventListener = function (type, callback, options) { + if (options === void 0) { options = { passive: false, once: false, capture: false }; } + /** + * 1. Let capture, passive, and once be the result of flattening more options. + */ + var _a = __read(algorithm_1.eventTarget_flattenMore(options), 3), capture = _a[0], passive = _a[1], once = _a[2]; + // convert callback function to EventListener, return if null + var listenerCallback; + if (!callback) { + return; + } + else if (util_1.Guard.isEventListener(callback)) { + listenerCallback = callback; + } + else { + listenerCallback = { handleEvent: callback }; + } + /** + * 2. Add an event listener with the context object and an event listener + * whose type is type, callback is callback, capture is capture, passive is + * passive, and once is once. + */ + algorithm_1.eventTarget_addEventListener(this, { + type: type, + callback: listenerCallback, + capture: capture, + passive: passive, + once: once, + removed: false + }); + }; + /** @inheritdoc */ + EventTargetImpl.prototype.removeEventListener = function (type, callback, options) { + /** + * TODO: Implement realms + * 1. If the context object’s relevant global object is a + * ServiceWorkerGlobalScope object and its associated service worker’s + * script resource’s has ever been evaluated flag is set, then throw + * a TypeError. [SERVICE-WORKERS] + */ + if (options === void 0) { options = { capture: false }; } + /** + * 2. Let capture be the result of flattening options. + */ + var capture = algorithm_1.eventTarget_flatten(options); + if (!callback) + return; + /** + * 3. If the context object’s event listener list contains an event listener + * whose type is type, callback is callback, and capture is capture, then + * remove an event listener with the context object and that event listener. + */ + for (var i = 0; i < this._eventListenerList.length; i++) { + var entry = this._eventListenerList[i]; + if (entry.type !== type || entry.capture !== capture) + continue; + if (util_1.Guard.isEventListener(callback) && entry.callback === callback) { + algorithm_1.eventTarget_removeEventListener(this, entry, i); + break; + } + else if (callback && entry.callback.handleEvent === callback) { + algorithm_1.eventTarget_removeEventListener(this, entry, i); + break; + } + } + }; + /** @inheritdoc */ + EventTargetImpl.prototype.dispatchEvent = function (event) { + /** + * 1. If event’s dispatch flag is set, or if its initialized flag is not + * set, then throw an "InvalidStateError" DOMException. + * 2. Initialize event’s isTrusted attribute to false. + * 3. Return the result of dispatching event to the context object. + */ + if (event._dispatchFlag || !event._initializedFlag) { + throw new DOMException_1.InvalidStateError(); + } + event._isTrusted = false; + return algorithm_1.event_dispatch(event, this); + }; + /** @inheritdoc */ + EventTargetImpl.prototype._getTheParent = function (event) { + return null; + }; + return EventTargetImpl; +}()); +exports.EventTargetImpl = EventTargetImpl; +//# sourceMappingURL=EventTargetImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/EventTargetImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/EventTargetImpl.js.map new file mode 100644 index 0000000..bdd3198 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/EventTargetImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"EventTargetImpl.js","sourceRoot":"","sources":["../../src/dom/EventTargetImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAIA,+CAAkD;AAClD,gCAA+B;AAC/B,0CAGqB;AAErB;;GAEG;AACH;IAYE;;OAEG;IACH;IAAuB,CAAC;IAZxB,sBAAI,+CAAkB;aAAtB;YACE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;;;;WAIG;QACH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACvD,IAAM,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAA;YACxC,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,KAAK,OAAO;gBAAE,SAAQ;YAC9D,IAAI,YAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,KAAK,QAAQ,EAAE;gBAClE,2CAA+B,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;gBAC/C,MAAK;aACN;iBAAM,IAAI,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,KAAK,QAAQ,EAAE;gBAC9D,2CAA+B,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;gBAC/C,MAAK;aACN;SACF;IACH,CAAC;IAED,kBAAkB;IAClB,uCAAa,GAAb,UAAc,KAAY;QACxB;;;;;WAKG;QACH,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE;YAClD,MAAM,IAAI,gCAAiB,EAAE,CAAA;SAC9B;QACD,KAAK,CAAC,UAAU,GAAG,KAAK,CAAA;QAExB,OAAO,0BAAc,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IACpC,CAAC;IAED,kBAAkB;IAClB,uCAAa,GAAb,UAAc,KAAY;QACxB,OAAO,IAAI,CAAA;IACb,CAAC;IAWH,sBAAC;AAAD,CAAC,AAxHD,IAwHC;AAxHqB,0CAAe"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/HTMLCollectionImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/HTMLCollectionImpl.d.ts new file mode 100644 index 0000000..1158b43 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/HTMLCollectionImpl.d.ts @@ -0,0 +1,44 @@ +import { Node, Element, HTMLCollection } from "./interfaces"; +/** + * Represents a collection of elements. + */ +export declare class HTMLCollectionImpl implements HTMLCollection { + _live: boolean; + _root: Node; + _filter: ((element: Element) => boolean); + protected static reservedNames: string[]; + /** + * Initializes a new instance of `HTMLCollection`. + * + * @param root - root node + * @param filter - node filter + */ + private constructor(); + /** @inheritdoc */ + get length(): number; + /** @inheritdoc */ + item(index: number): Element | null; + /** @inheritdoc */ + namedItem(key: string): Element | null; + /** @inheritdoc */ + [Symbol.iterator](): Iterator; + /** @inheritdoc */ + [index: number]: Element | undefined; + /** @inheritdoc */ + [key: string]: any; + /** + * Implements a proxy get trap to provide array-like access. + */ + get(target: HTMLCollection, key: PropertyKey, receiver: any): Element | null | undefined; + /** + * Implements a proxy set trap to provide array-like access. + */ + set(target: HTMLCollection, key: PropertyKey, value: Element, receiver: any): boolean; + /** + * Creates a new `HTMLCollection`. + * + * @param root - root node + * @param filter - node filter + */ + static _create(root: Node, filter?: ((element: Element) => boolean)): HTMLCollectionImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/HTMLCollectionImpl.js b/node_modules/@oozcitak/dom/lib/dom/HTMLCollectionImpl.js new file mode 100644 index 0000000..4bf1f96 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/HTMLCollectionImpl.js @@ -0,0 +1,157 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var infra_1 = require("@oozcitak/infra"); +var algorithm_1 = require("../algorithm"); +var util_1 = require("../util"); +var util_2 = require("@oozcitak/util"); +/** + * Represents a collection of elements. + */ +var HTMLCollectionImpl = /** @class */ (function () { + /** + * Initializes a new instance of `HTMLCollection`. + * + * @param root - root node + * @param filter - node filter + */ + function HTMLCollectionImpl(root, filter) { + this._live = true; + this._root = root; + this._filter = filter; + return new Proxy(this, this); + } + Object.defineProperty(HTMLCollectionImpl.prototype, "length", { + /** @inheritdoc */ + get: function () { + var _this = this; + /** + * The length attribute’s getter must return the number of nodes + * represented by the collection. + */ + var count = 0; + var node = algorithm_1.tree_getFirstDescendantNode(this._root, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); + while (node !== null) { + count++; + node = algorithm_1.tree_getNextDescendantNode(this._root, node, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); + } + return count; + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + HTMLCollectionImpl.prototype.item = function (index) { + var _this = this; + /** + * The item(index) method, when invoked, must return the indexth element + * in the collection. If there is no indexth element in the collection, + * then the method must return null. + */ + var i = 0; + var node = algorithm_1.tree_getFirstDescendantNode(this._root, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); + while (node !== null) { + if (i === index) + return node; + else + i++; + node = algorithm_1.tree_getNextDescendantNode(this._root, node, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); + } + return null; + }; + /** @inheritdoc */ + HTMLCollectionImpl.prototype.namedItem = function (key) { + var _this = this; + /** + * 1. If key is the empty string, return null. + * 2. Return the first element in the collection for which at least one of + * the following is true: + * - it has an ID which is key; + * - it is in the HTML namespace and has a name attribute whose value is key; + * or null if there is no such element. + */ + if (key === '') + return null; + var ele = algorithm_1.tree_getFirstDescendantNode(this._root, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); + while (ele != null) { + if (ele._uniqueIdentifier === key) { + return ele; + } + else if (ele._namespace === infra_1.namespace.HTML) { + for (var i = 0; i < ele._attributeList.length; i++) { + var attr = ele._attributeList[i]; + if (attr._localName === "name" && attr._namespace === null && + attr._namespacePrefix === null && attr._value === key) + return ele; + } + } + ele = algorithm_1.tree_getNextDescendantNode(this._root, ele, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); + } + return null; + }; + /** @inheritdoc */ + HTMLCollectionImpl.prototype[Symbol.iterator] = function () { + var root = this._root; + var filter = this._filter; + var currentNode = algorithm_1.tree_getFirstDescendantNode(root, false, false, function (e) { return util_1.Guard.isElementNode(e) && filter(e); }); + return { + next: function () { + if (currentNode === null) { + return { done: true, value: null }; + } + else { + var result = { done: false, value: currentNode }; + currentNode = algorithm_1.tree_getNextDescendantNode(root, currentNode, false, false, function (e) { return util_1.Guard.isElementNode(e) && filter(e); }); + return result; + } + } + }; + }; + /** + * Implements a proxy get trap to provide array-like access. + */ + HTMLCollectionImpl.prototype.get = function (target, key, receiver) { + if (!util_2.isString(key) || HTMLCollectionImpl.reservedNames.indexOf(key) !== -1) { + return Reflect.get(target, key, receiver); + } + var index = Number(key); + if (isNaN(index)) { + return target.namedItem(key) || undefined; + } + else { + return target.item(index) || undefined; + } + }; + /** + * Implements a proxy set trap to provide array-like access. + */ + HTMLCollectionImpl.prototype.set = function (target, key, value, receiver) { + if (!util_2.isString(key) || HTMLCollectionImpl.reservedNames.indexOf(key) !== -1) { + return Reflect.set(target, key, value, receiver); + } + var index = Number(key); + var node = isNaN(index) ? + target.namedItem(key) || undefined : target.item(index) || undefined; + if (node && node._parent) { + algorithm_1.mutation_replace(node, value, node._parent); + return true; + } + else { + return false; + } + }; + /** + * Creates a new `HTMLCollection`. + * + * @param root - root node + * @param filter - node filter + */ + HTMLCollectionImpl._create = function (root, filter) { + if (filter === void 0) { filter = (function () { return true; }); } + return new HTMLCollectionImpl(root, filter); + }; + HTMLCollectionImpl.reservedNames = ['_root', '_live', '_filter', 'length', + 'item', 'namedItem', 'get', 'set']; + return HTMLCollectionImpl; +}()); +exports.HTMLCollectionImpl = HTMLCollectionImpl; +//# sourceMappingURL=HTMLCollectionImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/HTMLCollectionImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/HTMLCollectionImpl.js.map new file mode 100644 index 0000000..86ac8f2 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/HTMLCollectionImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"HTMLCollectionImpl.js","sourceRoot":"","sources":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AC,CAAA;YAC3C,OAAO,IAAI,CAAA;SACZ;aAAM;YACL,OAAO,KAAK,CAAA;SACb;IACH,CAAC;IAED;;;;;OAKG;IACI,0BAAO,GAAd,UAAe,IAAU,EACvB,MAAsD;QAAtD,uBAAA,EAAA,UAA2C,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC;QACtD,OAAO,IAAI,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAC7C,CAAC;IAlKgB,gCAAa,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ;QACrE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;IAkKtC,yBAAC;CAAA,AAzKD,IAyKC;AAzKY,gDAAkB"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/MutationObserverImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/MutationObserverImpl.d.ts new file mode 100644 index 0000000..db67f5e --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/MutationObserverImpl.d.ts @@ -0,0 +1,22 @@ +import { Node, MutationObserverInit, MutationRecord, MutationCallback, MutationObserver } from "./interfaces"; +/** + * Represents an object that can be used to observe mutations to the tree of + * nodes. + */ +export declare class MutationObserverImpl implements MutationObserver { + _callback: MutationCallback; + _nodeList: Node[]; + _recordQueue: MutationRecord[]; + /** + * Initializes a new instance of `MutationObserver`. + * + * @param callback - the callback function + */ + constructor(callback: MutationCallback); + /** @inheritdoc */ + observe(target: Node, options?: MutationObserverInit): void; + /** @inheritdoc */ + disconnect(): void; + /** @inheritdoc */ + takeRecords(): MutationRecord[]; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/MutationObserverImpl.js b/node_modules/@oozcitak/dom/lib/dom/MutationObserverImpl.js new file mode 100644 index 0000000..c860590 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/MutationObserverImpl.js @@ -0,0 +1,184 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("./DOMImpl"); +var util_1 = require("../util"); +var infra_1 = require("@oozcitak/infra"); +/** + * Represents an object that can be used to observe mutations to the tree of + * nodes. + */ +var MutationObserverImpl = /** @class */ (function () { + /** + * Initializes a new instance of `MutationObserver`. + * + * @param callback - the callback function + */ + function MutationObserverImpl(callback) { + this._nodeList = []; + this._recordQueue = []; + /** + * 1. Let mo be a new MutationObserver object whose callback is callback. + * 2. Append mo to mo’s relevant agent’s mutation observers. + * 3. Return mo. + */ + this._callback = callback; + var window = DOMImpl_1.dom.window; + infra_1.set.append(window._mutationObservers, this); + } + /** @inheritdoc */ + MutationObserverImpl.prototype.observe = function (target, options) { + var e_1, _a; + options = options || { + childList: false, + subtree: false + }; + /** + * 1. If either options’s attributeOldValue or attributeFilter is present + * and options’s attributes is omitted, then set options’s attributes + * to true. + * 2. If options’s characterDataOldValue is present and options’s + * characterData is omitted, then set options’s characterData to true. + * 3. If none of options’s childList, attributes, and characterData is + * true, then throw a TypeError. + * 4. If options’s attributeOldValue is true and options’s attributes is + * false, then throw a TypeError. + * 5. If options’s attributeFilter is present and options’s attributes is + * false, then throw a TypeError. + * 6. If options’s characterDataOldValue is true and options’s characterData + * is false, then throw a TypeError. + */ + if ((options.attributeOldValue !== undefined || options.attributeFilter !== undefined) && + options.attributes === undefined) { + options.attributes = true; + } + if (options.characterDataOldValue !== undefined && options.characterData === undefined) { + options.characterData = true; + } + if (!options.childList && !options.attributes && !options.characterData) { + throw new TypeError(); + } + if (options.attributeOldValue && !options.attributes) { + throw new TypeError(); + } + if (options.attributeFilter !== undefined && !options.attributes) { + throw new TypeError(); + } + if (options.characterDataOldValue && !options.characterData) { + throw new TypeError(); + } + /** + * 7. For each registered of target’s registered observer list, if + * registered’s observer is the context object: + */ + var isRegistered = false; + var coptions = options; + var _loop_1 = function (registered) { + var e_2, _a; + if (registered.observer === this_1) { + isRegistered = true; + try { + /** + * 7.1. For each node of the context object’s node list, remove all + * transient registered observers whose source is registered from node’s + * registered observer list. + */ + for (var _b = (e_2 = void 0, __values(this_1._nodeList)), _c = _b.next(); !_c.done; _c = _b.next()) { + var node = _c.value; + infra_1.list.remove(node._registeredObserverList, function (ob) { + return util_1.Guard.isTransientRegisteredObserver(ob) && ob.source === registered; + }); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_2) throw e_2.error; } + } + /** + * 7.2. Set registered’s options to options. + */ + registered.options = coptions; + } + }; + var this_1 = this; + try { + for (var _b = __values(target._registeredObserverList), _c = _b.next(); !_c.done; _c = _b.next()) { + var registered = _c.value; + _loop_1(registered); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + /** + * 8. Otherwise: + * 8.1. Append a new registered observer whose observer is the context + * object and options is options to target’s registered observer list. + * 8.2. Append target to the context object’s node list. + */ + if (!isRegistered) { + target._registeredObserverList.push({ observer: this, options: options }); + this._nodeList.push(target); + } + }; + /** @inheritdoc */ + MutationObserverImpl.prototype.disconnect = function () { + var e_3, _a; + var _this = this; + try { + /** + * 1. For each node of the context object’s node list, remove any + * registered observer from node’s registered observer list for which the + * context object is the observer. + */ + for (var _b = __values(this._nodeList), _c = _b.next(); !_c.done; _c = _b.next()) { + var node = _c.value; + infra_1.list.remove((node)._registeredObserverList, function (ob) { + return ob.observer === _this; + }); + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_3) throw e_3.error; } + } + /** + * 2. Empty the context object’s record queue. + */ + this._recordQueue = []; + }; + /** @inheritdoc */ + MutationObserverImpl.prototype.takeRecords = function () { + /** + * 1. Let records be a clone of the context object’s record queue. + * 2. Empty the context object’s record queue. + * 3. Return records. + */ + var records = this._recordQueue; + this._recordQueue = []; + return records; + }; + return MutationObserverImpl; +}()); +exports.MutationObserverImpl = MutationObserverImpl; +//# sourceMappingURL=MutationObserverImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/MutationObserverImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/MutationObserverImpl.js.map new file mode 100644 index 0000000..4180a0e --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/MutationObserverImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MutationObserverImpl.js","sourceRoot":"","sources":["../../src/dom/MutationObserverImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAA+B;AAI/B,gCAA+B;AAC/B,yCAAoE;AAEpE;;;GAGG;AACH;IAME;;;;OAIG;IACH,8BAAmB,QAA0B;QAR7C,cAAS,GAAW,EAAE,CAAA;QACtB,iBAAY,GAAqB,EAAE,CAAA;QAQjC;;;;WAIG;QACH,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;QACzB,IAAM,MAAM,GAAG,aAAG,CAAC,MAAM,CAAA;QACzB,WAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAA;IAClD,CAAC;IAED,kBAAkB;IAClB,sCAAO,GAAP,UAAQ,MAAY,EAAE,OAA8B;;QAClD,OAAO,GAAG,OAAO,IAAI;YACnB,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE,KAAK;SACf,CAAA;QAED;;;;;;;;;;;;;;WAcG;QACH,IAAI,CAAC,OAAO,CAAC,iBAAiB,KAAK,SAAS,IAAI,OAAO,CAAC,eAAe,KAAK,SAAS,CAAC;YACpF,OAAO,CAAC,UAAU,KAAK,SAAS,EAA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H,KAAyB,IAAA,KAAA,SAAA,MAAM,CAAC,uBAAuB,CAAA,gBAAA;gBAAlD,IAAM,UAAU,WAAA;wBAAV,UAAU;aAkBpB;;;;;;;;;QAED;;;;;WAKG;QACH,IAAI,CAAC,YAAY,EAAE;YACjB,MAAM,CAAC,uBAAuB,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAA;YACzE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;SAC5B;IACH,CAAC;IAED,kBAAkB;IAClB,yCAAU,GAAV;;QAAA,iBAgBC;;YAfC;;;;eAIG;YACH,KAAmB,IAAA,KAAA,SAAA,IAAI,CAAC,SAAS,CAAA,gBAAA,4BAAE;gBAA9B,IAAM,IAAI,WAAA;gBACb,YAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,uBAAuB,EAAE,UAAC,EAAE;oBAClD,OAAA,EAAE,CAAC,QAAQ,KAAK,KAAI;gBAApB,CAAoB,CACrB,CAAA;aACF;;;;;;;;;QAED;;WAEG;QACH,IAAI,CAAC,YAAY,GAAG,EAAE,CAAA;IACxB,CAAC;IAED,kBAAkB;IAClB,0CAAW,GAAX;QACE;;;;WAIG;QACH,IAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAA;QACjC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAA;QACtB,OAAO,OAAO,CAAA;IAChB,CAAC;IAEH,2BAAC;AAAD,CAAC,AArID,IAqIC;AArIY,oDAAoB"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/MutationRecordImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/MutationRecordImpl.d.ts new file mode 100644 index 0000000..24b3368 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/MutationRecordImpl.d.ts @@ -0,0 +1,73 @@ +import { Node, NodeList, MutationRecord } from "./interfaces"; +/** + * Represents a mutation record. + */ +export declare class MutationRecordImpl implements MutationRecord { + private _type; + private _target; + private _addedNodes; + private _removedNodes; + private _previousSibling; + private _nextSibling; + private _attributeName; + private _attributeNamespace; + private _oldValue; + /** + * Initializes a new instance of `MutationRecord`. + * + * @param type - type of mutation: `"attributes"` for an attribute + * mutation, `"characterData"` for a mutation to a CharacterData node + * and `"childList"` for a mutation to the tree of nodes. + * @param target - node affected by the mutation. + * @param addedNodes - list of added nodes. + * @param removedNodes - list of removed nodes. + * @param previousSibling - previous sibling of added or removed nodes. + * @param nextSibling - next sibling of added or removed nodes. + * @param attributeName - local name of the changed attribute, + * and `null` otherwise. + * @param attributeNamespace - namespace of the changed attribute, + * and `null` otherwise. + * @param oldValue - value before mutation: attribute value for an attribute + * mutation, node `data` for a mutation to a CharacterData node and `null` + * for a mutation to the tree of nodes. + */ + private constructor(); + /** @inheritdoc */ + get type(): "attributes" | "characterData" | "childList"; + /** @inheritdoc */ + get target(): Node; + /** @inheritdoc */ + get addedNodes(): NodeList; + /** @inheritdoc */ + get removedNodes(): NodeList; + /** @inheritdoc */ + get previousSibling(): Node | null; + /** @inheritdoc */ + get nextSibling(): Node | null; + /** @inheritdoc */ + get attributeName(): string | null; + /** @inheritdoc */ + get attributeNamespace(): string | null; + /** @inheritdoc */ + get oldValue(): string | null; + /** + * Creates a new `MutationRecord`. + * + * @param type - type of mutation: `"attributes"` for an attribute + * mutation, `"characterData"` for a mutation to a CharacterData node + * and `"childList"` for a mutation to the tree of nodes. + * @param target - node affected by the mutation. + * @param addedNodes - list of added nodes. + * @param removedNodes - list of removed nodes. + * @param previousSibling - previous sibling of added or removed nodes. + * @param nextSibling - next sibling of added or removed nodes. + * @param attributeName - local name of the changed attribute, + * and `null` otherwise. + * @param attributeNamespace - namespace of the changed attribute, + * and `null` otherwise. + * @param oldValue - value before mutation: attribute value for an attribute + * mutation, node `data` for a mutation to a CharacterData node and `null` + * for a mutation to the tree of nodes. + */ + static _create(type: "attributes" | "characterData" | "childList", target: Node, addedNodes: NodeList, removedNodes: NodeList, previousSibling: Node | null, nextSibling: Node | null, attributeName: string | null, attributeNamespace: string | null, oldValue: string | null): MutationRecordImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/MutationRecordImpl.js b/node_modules/@oozcitak/dom/lib/dom/MutationRecordImpl.js new file mode 100644 index 0000000..b17e1b0 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/MutationRecordImpl.js @@ -0,0 +1,116 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Represents a mutation record. + */ +var MutationRecordImpl = /** @class */ (function () { + /** + * Initializes a new instance of `MutationRecord`. + * + * @param type - type of mutation: `"attributes"` for an attribute + * mutation, `"characterData"` for a mutation to a CharacterData node + * and `"childList"` for a mutation to the tree of nodes. + * @param target - node affected by the mutation. + * @param addedNodes - list of added nodes. + * @param removedNodes - list of removed nodes. + * @param previousSibling - previous sibling of added or removed nodes. + * @param nextSibling - next sibling of added or removed nodes. + * @param attributeName - local name of the changed attribute, + * and `null` otherwise. + * @param attributeNamespace - namespace of the changed attribute, + * and `null` otherwise. + * @param oldValue - value before mutation: attribute value for an attribute + * mutation, node `data` for a mutation to a CharacterData node and `null` + * for a mutation to the tree of nodes. + */ + function MutationRecordImpl(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue) { + this._type = type; + this._target = target; + this._addedNodes = addedNodes; + this._removedNodes = removedNodes; + this._previousSibling = previousSibling; + this._nextSibling = nextSibling; + this._attributeName = attributeName; + this._attributeNamespace = attributeNamespace; + this._oldValue = oldValue; + } + Object.defineProperty(MutationRecordImpl.prototype, "type", { + /** @inheritdoc */ + get: function () { return this._type; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MutationRecordImpl.prototype, "target", { + /** @inheritdoc */ + get: function () { return this._target; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MutationRecordImpl.prototype, "addedNodes", { + /** @inheritdoc */ + get: function () { return this._addedNodes; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MutationRecordImpl.prototype, "removedNodes", { + /** @inheritdoc */ + get: function () { return this._removedNodes; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MutationRecordImpl.prototype, "previousSibling", { + /** @inheritdoc */ + get: function () { return this._previousSibling; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MutationRecordImpl.prototype, "nextSibling", { + /** @inheritdoc */ + get: function () { return this._nextSibling; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MutationRecordImpl.prototype, "attributeName", { + /** @inheritdoc */ + get: function () { return this._attributeName; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MutationRecordImpl.prototype, "attributeNamespace", { + /** @inheritdoc */ + get: function () { return this._attributeNamespace; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MutationRecordImpl.prototype, "oldValue", { + /** @inheritdoc */ + get: function () { return this._oldValue; }, + enumerable: true, + configurable: true + }); + /** + * Creates a new `MutationRecord`. + * + * @param type - type of mutation: `"attributes"` for an attribute + * mutation, `"characterData"` for a mutation to a CharacterData node + * and `"childList"` for a mutation to the tree of nodes. + * @param target - node affected by the mutation. + * @param addedNodes - list of added nodes. + * @param removedNodes - list of removed nodes. + * @param previousSibling - previous sibling of added or removed nodes. + * @param nextSibling - next sibling of added or removed nodes. + * @param attributeName - local name of the changed attribute, + * and `null` otherwise. + * @param attributeNamespace - namespace of the changed attribute, + * and `null` otherwise. + * @param oldValue - value before mutation: attribute value for an attribute + * mutation, node `data` for a mutation to a CharacterData node and `null` + * for a mutation to the tree of nodes. + */ + MutationRecordImpl._create = function (type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue) { + return new MutationRecordImpl(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue); + }; + return MutationRecordImpl; +}()); +exports.MutationRecordImpl = MutationRecordImpl; +//# sourceMappingURL=MutationRecordImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/MutationRecordImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/MutationRecordImpl.js.map new file mode 100644 index 0000000..5e03d26 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/MutationRecordImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MutationRecordImpl.js","sourceRoot":"","sources":["../../src/dom/MutationRecordImpl.ts"],"names":[],"mappings":";;AAEA;;GAEG;AACH;IAYE;;;;;;;;;;;;;;;;;;OAkBG;IACH,4BAAoB,IAAkD,EACpE,MAAY,EAAE,UAAoB,EAClC,YAAsB,EAAE,eAA4B,EACpD,WAAwB,EAAE,aAA4B,EACtD,kBAAiC,EAAE,QAAuB;QAE1D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACrB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAA;QAC7B,IAAI,CAAC,aAAa,GAAG,YAAY,CAAA;QACjC,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAA;QACvC,IAAI,CAAC,YAAY,GAAG,WAAW,CAAA;QAC/B,IAAI,CAAC,cAAc,GAAG,aAAa,CAAA;QACnC,IAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAA;QAC7C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;IAC3B,CAAC;IAGD,sBAAI,oCAAI;QADR,kBAAkB;aAClB,cAA2D,OAAO,IAAI,CAAC,KAAK,CAAA,CAAC,CAAC;;;OAAA;IAG9E,sBAAI,sCAAM;QADV,kBAAkB;aAClB,cAAqB,OAAO,IAAI,CAAC,OAAO,CAAA,CAAC,CAAC;;;OAAA;IAG1C,sBAAI,0CAAU;QADd,kBAAkB;aAClB,cAA6B,OAAO,IAAI,CAAC,WAAW,CAAA,CAAC,CAAC;;;OAAA;IAGtD,sBAAI,4CAAY;QADhB,kBAAkB;aAClB,cAA+B,OAAO,IAAI,CAAC,aAAa,CAAA,CAAC,CAAC;;;OAAA;IAG1D,sBAAI,+CAAe;QADnB,kBAAkB;aAClB,cAAqC,OAAO,IAAI,CAAC,gBAAgB,CAAA,CAAC,CAAC;;;OAAA;IAGnE,sBAAI,2CAAW;QADf,kBAAkB;aAClB,cAAiC,OAAO,IAAI,CAAC,YAAY,CAAA,CAAC,CAAC;;;OAAA;IAG3D,sBAAI,6CAAa;QADjB,kBAAkB;aAClB,cAAqC,OAAO,IAAI,CAAC,cAAc,CAAA,CAAC,CAAC;;;OAAA;IAGjE,sBAAI,kDAAkB;QADtB,kBAAkB;aAClB,cAA0C,OAAO,IAAI,CAAC,mBAAmB,CAAA,CAAC,CAAC;;;OAAA;IAG3E,sBAAI,wCAAQ;QADZ,kBAAkB;aAClB,cAAgC,OAAO,IAAI,CAAC,SAAS,CAAA,CAAC,CAAC;;;OAAA;IAEvD;;;;;;;;;;;;;;;;;;OAkBG;IACI,0BAAO,GAAd,UAAe,IAAkD,EAC/D,MAAY,EAAE,UAAoB,EAClC,YAAsB,EAAE,eAA4B,EACpD,WAAwB,EAAE,aAA4B,EACtD,kBAAiC,EAAE,QAAuB;QAE1D,OAAO,IAAI,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAClE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAC/D,QAAQ,CAAC,CAAA;IACb,CAAC;IACH,yBAAC;AAAD,CAAC,AAxGD,IAwGC;AAxGY,gDAAkB"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/NamedNodeMapImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/NamedNodeMapImpl.d.ts new file mode 100644 index 0000000..3b42f5f --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NamedNodeMapImpl.d.ts @@ -0,0 +1,34 @@ +import { Element, Attr, NamedNodeMap } from "./interfaces"; +/** + * Represents a collection of attributes. + */ +export declare class NamedNodeMapImpl extends Array implements NamedNodeMap { + _element: Element; + /** + * Initializes a new instance of `NamedNodeMap`. + * + * @param element - parent element + */ + private constructor(); + _asArray(): Array; + /** @inheritdoc */ + item(index: number): Attr | null; + /** @inheritdoc */ + getNamedItem(qualifiedName: string): Attr | null; + /** @inheritdoc */ + getNamedItemNS(namespace: string | null, localName: string): Attr | null; + /** @inheritdoc */ + setNamedItem(attr: Attr): Attr | null; + /** @inheritdoc */ + setNamedItemNS(attr: Attr): Attr | null; + /** @inheritdoc */ + removeNamedItem(qualifiedName: string): Attr; + /** @inheritdoc */ + removeNamedItemNS(namespace: string | null, localName: string): Attr; + /** + * Creates a new `NamedNodeMap`. + * + * @param element - parent element + */ + static _create(element: Element): NamedNodeMapImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/NamedNodeMapImpl.js b/node_modules/@oozcitak/dom/lib/dom/NamedNodeMapImpl.js new file mode 100644 index 0000000..29b266f --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NamedNodeMapImpl.js @@ -0,0 +1,112 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMException_1 = require("./DOMException"); +var algorithm_1 = require("../algorithm"); +/** + * Represents a collection of attributes. + */ +var NamedNodeMapImpl = /** @class */ (function (_super) { + __extends(NamedNodeMapImpl, _super); + /** + * Initializes a new instance of `NamedNodeMap`. + * + * @param element - parent element + */ + function NamedNodeMapImpl(element) { + var _this = _super.call(this) || this; + _this._element = element; + // TODO: This workaround is needed to extend Array in ES5 + Object.setPrototypeOf(_this, NamedNodeMapImpl.prototype); + return _this; + } + NamedNodeMapImpl.prototype._asArray = function () { return this; }; + /** @inheritdoc */ + NamedNodeMapImpl.prototype.item = function (index) { + /** + * 1. If index is equal to or greater than context object’s attribute list’s + * size, then return null. + * 2. Otherwise, return context object’s attribute list[index]. + * + */ + return this[index] || null; + }; + /** @inheritdoc */ + NamedNodeMapImpl.prototype.getNamedItem = function (qualifiedName) { + /** + * The getNamedItem(qualifiedName) method, when invoked, must return the + * result of getting an attribute given qualifiedName and element. + */ + return algorithm_1.element_getAnAttributeByName(qualifiedName, this._element); + }; + /** @inheritdoc */ + NamedNodeMapImpl.prototype.getNamedItemNS = function (namespace, localName) { + /** + * The getNamedItemNS(namespace, localName) method, when invoked, must + * return the result of getting an attribute given namespace, localName, + * and element. + */ + return algorithm_1.element_getAnAttributeByNamespaceAndLocalName(namespace || '', localName, this._element); + }; + /** @inheritdoc */ + NamedNodeMapImpl.prototype.setNamedItem = function (attr) { + /** + * The setNamedItem(attr) and setNamedItemNS(attr) methods, when invoked, + * must return the result of setting an attribute given attr and element. + */ + return algorithm_1.element_setAnAttribute(attr, this._element); + }; + /** @inheritdoc */ + NamedNodeMapImpl.prototype.setNamedItemNS = function (attr) { + return algorithm_1.element_setAnAttribute(attr, this._element); + }; + /** @inheritdoc */ + NamedNodeMapImpl.prototype.removeNamedItem = function (qualifiedName) { + /** + * 1. Let attr be the result of removing an attribute given qualifiedName + * and element. + * 2. If attr is null, then throw a "NotFoundError" DOMException. + * 3. Return attr. + */ + var attr = algorithm_1.element_removeAnAttributeByName(qualifiedName, this._element); + if (attr === null) + throw new DOMException_1.NotFoundError(); + return attr; + }; + /** @inheritdoc */ + NamedNodeMapImpl.prototype.removeNamedItemNS = function (namespace, localName) { + /** + * 1. Let attr be the result of removing an attribute given namespace, + * localName, and element. + * 2. If attr is null, then throw a "NotFoundError" DOMException. + * 3. Return attr. + */ + var attr = algorithm_1.element_removeAnAttributeByNamespaceAndLocalName(namespace || '', localName, this._element); + if (attr === null) + throw new DOMException_1.NotFoundError(); + return attr; + }; + /** + * Creates a new `NamedNodeMap`. + * + * @param element - parent element + */ + NamedNodeMapImpl._create = function (element) { + return new NamedNodeMapImpl(element); + }; + return NamedNodeMapImpl; +}(Array)); +exports.NamedNodeMapImpl = NamedNodeMapImpl; +//# sourceMappingURL=NamedNodeMapImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/NamedNodeMapImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/NamedNodeMapImpl.js.map new file mode 100644 index 0000000..8abf2b3 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NamedNodeMapImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NamedNodeMapImpl.js","sourceRoot":"","sources":["../../src/dom/NamedNodeMapImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,+CAA8C;AAC9C,0CAIqB;AAErB;;GAEG;AACH;IAAsC,oCAAW;IAI/C;;;;OAIG;IACH,0BAAoB,OAAgB;QAApC,YACE,iBAAO,SAIR;QAHC,KAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,yDAAyD;QACzD,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAA;;IACzD,CAAC;IAED,mCAAQ,GAAR,cAA0B,OAAO,IAAI,CAAA,CAAC,CAAC;IAEvC,kBAAkB;IAClB,+BAAI,GAAJ,UAAK,KAAa;QAChB;;;;;WAKG;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAA;IAC5B,CAAC;IAED,kBAAkB;IAClB,uCAAY,GAAZ,UAAa,aAAqB;QAChC;;;WAGG;QACH,OAAO,wCAA4B,CAAC,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IACnE,CAAC;IAED,kBAAkB;IAClB,yCAAc,GAAd,UAAe,SAAwB,EAAE,SAAiB;QACxD;;;;WAIG;QACH,OAAO,yDAA6C,CAClD,SAAS,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC9C,CAAC;IAED,kBAAkB;IAClB,uCAAY,GAAZ,UAAa,IAAU;QACrB;;;WAGG;QACH,OAAO,kCAAsB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IACpD,CAAC;IAED,kBAAkB;IAClB,yCAAc,GAAd,UAAe,IAAU;QACvB,OAAO,kCAAsB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IACpD,CAAC;IAED,kBAAkB;IAClB,0CAAe,GAAf,UAAgB,aAAqB;QACnC;;;;;WAKG;QACH,IAAM,IAAI,GAAG,2CAA+B,CAAC,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QAE1E,IAAI,IAAI,KAAK,IAAI;YACf,MAAM,IAAI,4BAAa,EAAE,CAAA;QAE3B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,kBAAkB;IAClB,4CAAiB,GAAjB,UAAkB,SAAwB,EAAE,SAAiB;QAC3D;;;;;WAKG;QACH,IAAM,IAAI,GAAG,4DAAgD,CAC3D,SAAS,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QAE5C,IAAI,IAAI,KAAK,IAAI;YACf,MAAM,IAAI,4BAAa,EAAE,CAAA;QAE3B,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;OAIG;IACI,wBAAO,GAAd,UAAe,OAAgB;QAC7B,OAAO,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAA;IACtC,CAAC;IACH,uBAAC;AAAD,CAAC,AAxGD,CAAsC,KAAK,GAwG1C;AAxGY,4CAAgB"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/NodeFilterImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/NodeFilterImpl.d.ts new file mode 100644 index 0000000..7f5cac4 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NodeFilterImpl.d.ts @@ -0,0 +1,50 @@ +import { Node, FilterResult, NodeFilter } from "./interfaces"; +/** + * Represents a node filter. + */ +export declare class NodeFilterImpl implements NodeFilter { + static FILTER_ACCEPT: number; + static FILTER_REJECT: number; + static FILTER_SKIP: number; + static SHOW_ALL: number; + static SHOW_ELEMENT: number; + static SHOW_ATTRIBUTE: number; + static SHOW_TEXT: number; + static SHOW_CDATA_SECTION: number; + static SHOW_ENTITY_REFERENCE: number; + static SHOW_ENTITY: number; + static SHOW_PROCESSING_INSTRUCTION: number; + static SHOW_COMMENT: number; + static SHOW_DOCUMENT: number; + static SHOW_DOCUMENT_TYPE: number; + static SHOW_DOCUMENT_FRAGMENT: number; + static SHOW_NOTATION: number; + FILTER_ACCEPT: number; + FILTER_REJECT: number; + FILTER_SKIP: number; + SHOW_ALL: number; + SHOW_ELEMENT: number; + SHOW_ATTRIBUTE: number; + SHOW_TEXT: number; + SHOW_CDATA_SECTION: number; + SHOW_ENTITY_REFERENCE: number; + SHOW_ENTITY: number; + SHOW_PROCESSING_INSTRUCTION: number; + SHOW_COMMENT: number; + SHOW_DOCUMENT: number; + SHOW_DOCUMENT_TYPE: number; + SHOW_DOCUMENT_FRAGMENT: number; + SHOW_NOTATION: number; + /** + * Initializes a new instance of `NodeFilter`. + */ + private constructor(); + /** + * Callback function. + */ + acceptNode(node: Node): FilterResult; + /** + * Creates a new `NodeFilter`. + */ + static _create(): NodeFilter; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/NodeFilterImpl.js b/node_modules/@oozcitak/dom/lib/dom/NodeFilterImpl.js new file mode 100644 index 0000000..884c425 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NodeFilterImpl.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("./interfaces"); +var WebIDLAlgorithm_1 = require("../algorithm/WebIDLAlgorithm"); +/** + * Represents a node filter. + */ +var NodeFilterImpl = /** @class */ (function () { + /** + * Initializes a new instance of `NodeFilter`. + */ + function NodeFilterImpl() { + } + /** + * Callback function. + */ + NodeFilterImpl.prototype.acceptNode = function (node) { + return interfaces_1.FilterResult.Accept; + }; + /** + * Creates a new `NodeFilter`. + */ + NodeFilterImpl._create = function () { + return new NodeFilterImpl(); + }; + NodeFilterImpl.FILTER_ACCEPT = 1; + NodeFilterImpl.FILTER_REJECT = 2; + NodeFilterImpl.FILTER_SKIP = 3; + NodeFilterImpl.SHOW_ALL = 0xffffffff; + NodeFilterImpl.SHOW_ELEMENT = 0x1; + NodeFilterImpl.SHOW_ATTRIBUTE = 0x2; + NodeFilterImpl.SHOW_TEXT = 0x4; + NodeFilterImpl.SHOW_CDATA_SECTION = 0x8; + NodeFilterImpl.SHOW_ENTITY_REFERENCE = 0x10; + NodeFilterImpl.SHOW_ENTITY = 0x20; + NodeFilterImpl.SHOW_PROCESSING_INSTRUCTION = 0x40; + NodeFilterImpl.SHOW_COMMENT = 0x80; + NodeFilterImpl.SHOW_DOCUMENT = 0x100; + NodeFilterImpl.SHOW_DOCUMENT_TYPE = 0x200; + NodeFilterImpl.SHOW_DOCUMENT_FRAGMENT = 0x400; + NodeFilterImpl.SHOW_NOTATION = 0x800; + return NodeFilterImpl; +}()); +exports.NodeFilterImpl = NodeFilterImpl; +/** + * Define constants on prototype. + */ +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "FILTER_ACCEPT", 1); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "FILTER_REJECT", 2); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "FILTER_SKIP", 3); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ALL", 0xffffffff); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ELEMENT", 0x1); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ATTRIBUTE", 0x2); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_TEXT", 0x4); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_CDATA_SECTION", 0x8); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ENTITY_REFERENCE", 0x10); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ENTITY", 0x20); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_PROCESSING_INSTRUCTION", 0x40); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_COMMENT", 0x80); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_DOCUMENT", 0x100); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_DOCUMENT_TYPE", 0x200); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_DOCUMENT_FRAGMENT", 0x400); +WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_NOTATION", 0x800); +//# sourceMappingURL=NodeFilterImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/NodeFilterImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/NodeFilterImpl.js.map new file mode 100644 index 0000000..0292873 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NodeFilterImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NodeFilterImpl.js","sourceRoot":"","sources":["../../src/dom/NodeFilterImpl.ts"],"names":[],"mappings":";;AAAA,2CAA6D;AAC7D,gEAA8D;AAE9D;;GAEG;AACH;IAsCE;;OAEG;IACH;IAEA,CAAC;IAED;;OAEG;IACH,mCAAU,GAAV,UAAW,IAAU;QACnB,OAAO,yBAAY,CAAC,MAAM,CAAA;IAC5B,CAAC;IAED;;OAEG;IACI,sBAAO,GAAd;QACE,OAAO,IAAI,cAAc,EAAE,CAAA;IAC7B,CAAC;IAvDM,4BAAa,GAAG,CAAC,CAAA;IACjB,4BAAa,GAAG,CAAC,CAAA;IACjB,0BA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IAAI,CAAC,CAAA;AAC9D,iCAAe,CAAC,cAAc,CAAC,SAAS,EAAE,6BAA6B,EAAE,IAAI,CAAC,CAAA;AAC9E,iCAAe,CAAC,cAAc,CAAC,SAAS,EAAE,cAAc,EAAE,IAAI,CAAC,CAAA;AAC/D,iCAAe,CAAC,cAAc,CAAC,SAAS,EAAE,eAAe,EAAE,KAAK,CAAC,CAAA;AACjE,iCAAe,CAAC,cAAc,CAAC,SAAS,EAAE,oBAAoB,EAAE,KAAK,CAAC,CAAA;AACtE,iCAAe,CAAC,cAAc,CAAC,SAAS,EAAE,wBAAwB,EAAE,KAAK,CAAC,CAAA;AAC1E,iCAAe,CAAC,cAAc,CAAC,SAAS,EAAE,eAAe,EAAE,KAAK,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/NodeImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/NodeImpl.d.ts new file mode 100644 index 0000000..f451436 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NodeImpl.d.ts @@ -0,0 +1,252 @@ +import { Node, NodeList, Element, Document, NodeType, Position, GetRootNodeOptions, RegisteredObserver, TransientRegisteredObserver, Event, EventTarget } from "./interfaces"; +import { EventTargetImpl } from "./EventTargetImpl"; +/** + * Represents a generic XML node. + */ +export declare abstract class NodeImpl extends EventTargetImpl implements Node { + static ELEMENT_NODE: number; + static ATTRIBUTE_NODE: number; + static TEXT_NODE: number; + static CDATA_SECTION_NODE: number; + static ENTITY_REFERENCE_NODE: number; + static ENTITY_NODE: number; + static PROCESSING_INSTRUCTION_NODE: number; + static COMMENT_NODE: number; + static DOCUMENT_NODE: number; + static DOCUMENT_TYPE_NODE: number; + static DOCUMENT_FRAGMENT_NODE: number; + static NOTATION_NODE: number; + static DOCUMENT_POSITION_DISCONNECTED: number; + static DOCUMENT_POSITION_PRECEDING: number; + static DOCUMENT_POSITION_FOLLOWING: number; + static DOCUMENT_POSITION_CONTAINS: number; + static DOCUMENT_POSITION_CONTAINED_BY: number; + static DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + ELEMENT_NODE: number; + ATTRIBUTE_NODE: number; + TEXT_NODE: number; + CDATA_SECTION_NODE: number; + ENTITY_REFERENCE_NODE: number; + ENTITY_NODE: number; + PROCESSING_INSTRUCTION_NODE: number; + COMMENT_NODE: number; + DOCUMENT_NODE: number; + DOCUMENT_TYPE_NODE: number; + DOCUMENT_FRAGMENT_NODE: number; + NOTATION_NODE: number; + DOCUMENT_POSITION_DISCONNECTED: number; + DOCUMENT_POSITION_PRECEDING: number; + DOCUMENT_POSITION_FOLLOWING: number; + DOCUMENT_POSITION_CONTAINS: number; + DOCUMENT_POSITION_CONTAINED_BY: number; + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + private __childNodes?; + get _childNodes(): NodeList; + private _nodeDocumentOverride?; + get _nodeDocument(): Document; + set _nodeDocument(val: Document); + private __registeredObserverList?; + get _registeredObserverList(): (RegisteredObserver | TransientRegisteredObserver)[]; + abstract _nodeType: NodeType; + _parent: Node | null; + _children: Set; + _firstChild: Node | null; + _lastChild: Node | null; + _previousSibling: Node | null; + _nextSibling: Node | null; + /** + * Initializes a new instance of `Node`. + */ + protected constructor(); + /** @inheritdoc */ + get nodeType(): NodeType; + /** + * Returns a string appropriate for the type of node. + */ + get nodeName(): string; + /** + * Gets the absolute base URL of the node. + */ + get baseURI(): string; + /** + * Returns whether the node is rooted to a document node. + */ + get isConnected(): boolean; + /** + * Returns the parent document. + */ + get ownerDocument(): Document | null; + /** + * Returns the root node. + * + * @param options - if options has `composed = true` this function + * returns the node's shadow-including root, otherwise it returns + * the node's root node. + */ + getRootNode(options?: GetRootNodeOptions): Node; + /** + * Returns the parent node. + */ + get parentNode(): Node | null; + /** + * Returns the parent element. + */ + get parentElement(): Element | null; + /** + * Determines whether a node has any children. + */ + hasChildNodes(): boolean; + /** + * Returns a {@link NodeList} of child nodes. + */ + get childNodes(): NodeList; + /** + * Returns the first child node. + */ + get firstChild(): Node | null; + /** + * Returns the last child node. + */ + get lastChild(): Node | null; + /** + * Returns the previous sibling node. + */ + get previousSibling(): Node | null; + /** + * Returns the next sibling node. + */ + get nextSibling(): Node | null; + /** + * Gets or sets the data associated with a {@link CharacterData} node or the + * value of an {@link @Attr} node. For other node types returns `null`. + */ + get nodeValue(): string | null; + set nodeValue(value: string | null); + /** + * Returns the concatenation of data of all the {@link Text} + * node descendants in tree order. When set, replaces the text + * contents of the node with the given value. + */ + get textContent(): string | null; + set textContent(value: string | null); + /** + * Puts all {@link Text} nodes in the full depth of the sub-tree + * underneath this node into a "normal" form where only markup + * (e.g., tags, comments, processing instructions, CDATA sections, + * and entity references) separates {@link Text} nodes, i.e., there + * are no adjacent Text nodes. + */ + normalize(): void; + /** + * Returns a duplicate of this node, i.e., serves as a generic copy + * constructor for nodes. The duplicate node has no parent + * ({@link parentNode} returns `null`). + * + * @param deep - if `true`, recursively clone the subtree under the + * specified node. If `false`, clone only the node itself (and its + * attributes, if it is an {@link Element}). + */ + cloneNode(deep?: boolean): Node; + /** + * Determines if the given node is equal to this one. + * + * @param node - the node to compare with + */ + isEqualNode(node?: Node | null): boolean; + /** + * Determines if the given node is reference equal to this one. + * + * @param node - the node to compare with + */ + isSameNode(node?: Node | null): boolean; + /** + * Returns a bitmask indicating the position of the given `node` + * relative to this node. + */ + compareDocumentPosition(other: Node): Position; + /** + * Returns `true` if given node is an inclusive descendant of this + * node, and `false` otherwise (including when other node is `null`). + * + * @param other - the node to check + */ + contains(other: Node | null): boolean; + /** + * Returns the prefix for a given namespace URI, if present, and + * `null` if not. + * + * @param namespace - the namespace to search + */ + lookupPrefix(namespace: string | null): string | null; + /** + * Returns the namespace URI for a given prefix if present, and `null` + * if not. + * + * @param prefix - the prefix to search + */ + lookupNamespaceURI(prefix: string | null): string | null; + /** + * Returns `true` if the namespace is the default namespace on this + * node or `false` if not. + * + * @param namespace - the namespace to check + */ + isDefaultNamespace(namespace: string | null): boolean; + /** + * Inserts the node `newChild` before the existing child node + * `refChild`. If `refChild` is `null`, inserts `newChild` at the end + * of the list of children. + * + * If `newChild` is a {@link DocumentFragment} object, all of its + * children are inserted, in the same order, before `refChild`. + * + * If `newChild` is already in the tree, it is first removed. + * + * @param newChild - the node to insert + * @param refChild - the node before which the new node must be + * inserted + * + * @returns the newly inserted child node + */ + insertBefore(newChild: Node, refChild: Node | null): Node; + /** + * Adds the node `newChild` to the end of the list of children of this + * node, and returns it. If `newChild` is already in the tree, it is + * first removed. + * + * If `newChild` is a {@link DocumentFragment} object, the entire + * contents of the document fragment are moved into the child list of + * this node. + * + * @param newChild - the node to add + * + * @returns the newly inserted child node + */ + appendChild(newChild: Node): Node; + /** + * Replaces the child node `oldChild` with `newChild` in the list of + * children, and returns the `oldChild` node. If `newChild` is already + * in the tree, it is first removed. + * + * @param newChild - the new node to put in the child list + * @param oldChild - the node being replaced in the list + * + * @returns the removed child node + */ + replaceChild(newChild: Node, oldChild: Node): Node; + /** + * Removes the child node indicated by `oldChild` from the list of + * children, and returns it. + * + * @param oldChild - the node being removed from the list + * + * @returns the removed child node + */ + removeChild(oldChild: Node): Node; + /** + * Gets the parent event target for the given event. + * + * @param event - an event + */ + _getTheParent(event: Event): EventTarget | null; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/NodeImpl.js b/node_modules/@oozcitak/dom/lib/dom/NodeImpl.js new file mode 100644 index 0000000..74d19f2 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NodeImpl.js @@ -0,0 +1,891 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("./DOMImpl"); +var interfaces_1 = require("./interfaces"); +var EventTargetImpl_1 = require("./EventTargetImpl"); +var util_1 = require("../util"); +var DOMException_1 = require("./DOMException"); +var algorithm_1 = require("../algorithm"); +var URLAlgorithm_1 = require("@oozcitak/url/lib/URLAlgorithm"); +var WebIDLAlgorithm_1 = require("../algorithm/WebIDLAlgorithm"); +/** + * Represents a generic XML node. + */ +var NodeImpl = /** @class */ (function (_super) { + __extends(NodeImpl, _super); + /** + * Initializes a new instance of `Node`. + */ + function NodeImpl() { + var _this = _super.call(this) || this; + _this._parent = null; + _this._firstChild = null; + _this._lastChild = null; + _this._previousSibling = null; + _this._nextSibling = null; + return _this; + } + Object.defineProperty(NodeImpl.prototype, "_childNodes", { + get: function () { + return this.__childNodes || (this.__childNodes = algorithm_1.create_nodeList(this)); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "_nodeDocument", { + get: function () { return this._nodeDocumentOverride || DOMImpl_1.dom.window._associatedDocument; }, + set: function (val) { this._nodeDocumentOverride = val; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "_registeredObserverList", { + get: function () { + return this.__registeredObserverList || (this.__registeredObserverList = []); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "nodeType", { + /** @inheritdoc */ + get: function () { return this._nodeType; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "nodeName", { + /** + * Returns a string appropriate for the type of node. + */ + get: function () { + if (util_1.Guard.isElementNode(this)) { + return this._htmlUppercasedQualifiedName; + } + else if (util_1.Guard.isAttrNode(this)) { + return this._qualifiedName; + } + else if (util_1.Guard.isExclusiveTextNode(this)) { + return "#text"; + } + else if (util_1.Guard.isCDATASectionNode(this)) { + return "#cdata-section"; + } + else if (util_1.Guard.isProcessingInstructionNode(this)) { + return this._target; + } + else if (util_1.Guard.isCommentNode(this)) { + return "#comment"; + } + else if (util_1.Guard.isDocumentNode(this)) { + return "#document"; + } + else if (util_1.Guard.isDocumentTypeNode(this)) { + return this._name; + } + else if (util_1.Guard.isDocumentFragmentNode(this)) { + return "#document-fragment"; + } + else { + return ""; + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "baseURI", { + /** + * Gets the absolute base URL of the node. + */ + get: function () { + /** + * The baseURI attribute’s getter must return node document’s document + * base URL, serialized. + * TODO: Implement in HTML DOM + * https://html.spec.whatwg.org/multipage/urls-and-fetching.html#document-base-url + */ + return URLAlgorithm_1.urlSerializer(this._nodeDocument._URL); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "isConnected", { + /** + * Returns whether the node is rooted to a document node. + */ + get: function () { + /** + * The isConnected attribute’s getter must return true, if context object + * is connected, and false otherwise. + */ + return util_1.Guard.isElementNode(this) && algorithm_1.shadowTree_isConnected(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "ownerDocument", { + /** + * Returns the parent document. + */ + get: function () { + /** + * The ownerDocument attribute’s getter must return null, if the context + * object is a document, and the context object’s node document otherwise. + * _Note:_ The node document of a document is that document itself. All + * nodes have a node document at all times. + */ + if (this._nodeType === interfaces_1.NodeType.Document) + return null; + else + return this._nodeDocument; + }, + enumerable: true, + configurable: true + }); + /** + * Returns the root node. + * + * @param options - if options has `composed = true` this function + * returns the node's shadow-including root, otherwise it returns + * the node's root node. + */ + NodeImpl.prototype.getRootNode = function (options) { + /** + * The getRootNode(options) method, when invoked, must return context + * object’s shadow-including root if options’s composed is true, + * and context object’s root otherwise. + */ + return algorithm_1.tree_rootNode(this, !!options && options.composed); + }; + Object.defineProperty(NodeImpl.prototype, "parentNode", { + /** + * Returns the parent node. + */ + get: function () { + /** + * The parentNode attribute’s getter must return the context object’s parent. + * _Note:_ An Attr node has no parent. + */ + if (this._nodeType === interfaces_1.NodeType.Attribute) { + return null; + } + else { + return this._parent; + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "parentElement", { + /** + * Returns the parent element. + */ + get: function () { + /** + * The parentElement attribute’s getter must return the context object’s + * parent element. + */ + if (this._parent && util_1.Guard.isElementNode(this._parent)) { + return this._parent; + } + else { + return null; + } + }, + enumerable: true, + configurable: true + }); + /** + * Determines whether a node has any children. + */ + NodeImpl.prototype.hasChildNodes = function () { + /** + * The hasChildNodes() method, when invoked, must return true if the context + * object has children, and false otherwise. + */ + return (this._firstChild !== null); + }; + Object.defineProperty(NodeImpl.prototype, "childNodes", { + /** + * Returns a {@link NodeList} of child nodes. + */ + get: function () { + /** + * The childNodes attribute’s getter must return a NodeList rooted at the + * context object matching only children. + */ + return this._childNodes; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "firstChild", { + /** + * Returns the first child node. + */ + get: function () { + /** + * The firstChild attribute’s getter must return the context object’s first + * child. + */ + return this._firstChild; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "lastChild", { + /** + * Returns the last child node. + */ + get: function () { + /** + * The lastChild attribute’s getter must return the context object’s last + * child. + */ + return this._lastChild; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "previousSibling", { + /** + * Returns the previous sibling node. + */ + get: function () { + /** + * The previousSibling attribute’s getter must return the context object’s + * previous sibling. + * _Note:_ An Attr node has no siblings. + */ + return this._previousSibling; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "nextSibling", { + /** + * Returns the next sibling node. + */ + get: function () { + /** + * The nextSibling attribute’s getter must return the context object’s + * next sibling. + */ + return this._nextSibling; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "nodeValue", { + /** + * Gets or sets the data associated with a {@link CharacterData} node or the + * value of an {@link @Attr} node. For other node types returns `null`. + */ + get: function () { + if (util_1.Guard.isAttrNode(this)) { + return this._value; + } + else if (util_1.Guard.isCharacterDataNode(this)) { + return this._data; + } + else { + return null; + } + }, + set: function (value) { + if (value === null) { + value = ''; + } + if (util_1.Guard.isAttrNode(this)) { + algorithm_1.attr_setAnExistingAttributeValue(this, value); + } + else if (util_1.Guard.isCharacterDataNode(this)) { + algorithm_1.characterData_replaceData(this, 0, this._data.length, value); + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeImpl.prototype, "textContent", { + /** + * Returns the concatenation of data of all the {@link Text} + * node descendants in tree order. When set, replaces the text + * contents of the node with the given value. + */ + get: function () { + if (util_1.Guard.isDocumentFragmentNode(this) || util_1.Guard.isElementNode(this)) { + return algorithm_1.text_descendantTextContent(this); + } + else if (util_1.Guard.isAttrNode(this)) { + return this._value; + } + else if (util_1.Guard.isCharacterDataNode(this)) { + return this._data; + } + else { + return null; + } + }, + set: function (value) { + if (value === null) { + value = ''; + } + if (util_1.Guard.isDocumentFragmentNode(this) || util_1.Guard.isElementNode(this)) { + algorithm_1.node_stringReplaceAll(value, this); + } + else if (util_1.Guard.isAttrNode(this)) { + algorithm_1.attr_setAnExistingAttributeValue(this, value); + } + else if (util_1.Guard.isCharacterDataNode(this)) { + algorithm_1.characterData_replaceData(this, 0, algorithm_1.tree_nodeLength(this), value); + } + }, + enumerable: true, + configurable: true + }); + /** + * Puts all {@link Text} nodes in the full depth of the sub-tree + * underneath this node into a "normal" form where only markup + * (e.g., tags, comments, processing instructions, CDATA sections, + * and entity references) separates {@link Text} nodes, i.e., there + * are no adjacent Text nodes. + */ + NodeImpl.prototype.normalize = function () { + var e_1, _a, e_2, _b; + /** + * The normalize() method, when invoked, must run these steps for each + * descendant exclusive Text node node of context object: + */ + var descendantNodes = []; + var node = algorithm_1.tree_getFirstDescendantNode(this, false, false, function (e) { return util_1.Guard.isExclusiveTextNode(e); }); + while (node !== null) { + descendantNodes.push(node); + node = algorithm_1.tree_getNextDescendantNode(this, node, false, false, function (e) { return util_1.Guard.isExclusiveTextNode(e); }); + } + for (var i = 0; i < descendantNodes.length; i++) { + var node_1 = descendantNodes[i]; + if (node_1._parent === null) + continue; + /** + * 1. Let length be node’s length. + * 2. If length is zero, then remove node and continue with the next + * exclusive Text node, if any. + */ + var length = algorithm_1.tree_nodeLength(node_1); + if (length === 0) { + algorithm_1.mutation_remove(node_1, node_1._parent); + continue; + } + /** + * 3. Let data be the concatenation of the data of node’s contiguous + * exclusive Text nodes (excluding itself), in tree order. + */ + var textSiblings = []; + var data = ''; + try { + for (var _c = (e_1 = void 0, __values(algorithm_1.text_contiguousExclusiveTextNodes(node_1))), _d = _c.next(); !_d.done; _d = _c.next()) { + var sibling = _d.value; + textSiblings.push(sibling); + data += sibling._data; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_d && !_d.done && (_a = _c.return)) _a.call(_c); + } + finally { if (e_1) throw e_1.error; } + } + /** + * 4. Replace data with node node, offset length, count 0, and data data. + */ + algorithm_1.characterData_replaceData(node_1, length, 0, data); + /** + * 5. Let currentNode be node’s next sibling. + * 6. While currentNode is an exclusive Text node: + */ + if (DOMImpl_1.dom.rangeList.size !== 0) { + var currentNode = node_1._nextSibling; + while (currentNode !== null && util_1.Guard.isExclusiveTextNode(currentNode)) { + /** + * 6.1. For each live range whose start node is currentNode, add length + * to its start offset and set its start node to node. + * 6.2. For each live range whose end node is currentNode, add length to + * its end offset and set its end node to node. + * 6.3. For each live range whose start node is currentNode’s parent and + * start offset is currentNode’s index, set its start node to node and + * its start offset to length. + * 6.4. For each live range whose end node is currentNode’s parent and + * end offset is currentNode’s index, set its end node to node and its + * end offset to length. + */ + var cn = currentNode; + var index = algorithm_1.tree_index(cn); + try { + for (var _e = (e_2 = void 0, __values(DOMImpl_1.dom.rangeList)), _f = _e.next(); !_f.done; _f = _e.next()) { + var range = _f.value; + if (range._start[0] === cn) { + range._start[0] = node_1; + range._start[1] += length; + } + if (range._end[0] === cn) { + range._end[0] = node_1; + range._end[1] += length; + } + if (range._start[0] === cn._parent && range._start[1] === index) { + range._start[0] = node_1; + range._start[1] = length; + } + if (range._end[0] === cn._parent && range._end[1] === index) { + range._end[0] = node_1; + range._end[1] = length; + } + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_f && !_f.done && (_b = _e.return)) _b.call(_e); + } + finally { if (e_2) throw e_2.error; } + } + /** + * 6.5. Add currentNode’s length to length. + * 6.6. Set currentNode to its next sibling. + */ + length += algorithm_1.tree_nodeLength(currentNode); + currentNode = currentNode._nextSibling; + } + } + /** + * 7. Remove node’s contiguous exclusive Text nodes (excluding itself), + * in tree order. + */ + for (var i_1 = 0; i_1 < textSiblings.length; i_1++) { + var sibling = textSiblings[i_1]; + if (sibling._parent === null) + continue; + algorithm_1.mutation_remove(sibling, sibling._parent); + } + } + }; + /** + * Returns a duplicate of this node, i.e., serves as a generic copy + * constructor for nodes. The duplicate node has no parent + * ({@link parentNode} returns `null`). + * + * @param deep - if `true`, recursively clone the subtree under the + * specified node. If `false`, clone only the node itself (and its + * attributes, if it is an {@link Element}). + */ + NodeImpl.prototype.cloneNode = function (deep) { + if (deep === void 0) { deep = false; } + /** + * 1. If context object is a shadow root, then throw a "NotSupportedError" + * DOMException. + * 2. Return a clone of the context object, with the clone children flag set + * if deep is true. + */ + if (util_1.Guard.isShadowRoot(this)) + throw new DOMException_1.NotSupportedError(); + return algorithm_1.node_clone(this, null, deep); + }; + /** + * Determines if the given node is equal to this one. + * + * @param node - the node to compare with + */ + NodeImpl.prototype.isEqualNode = function (node) { + if (node === void 0) { node = null; } + /** + * The isEqualNode(otherNode) method, when invoked, must return true if + * otherNode is non-null and context object equals otherNode, and false + * otherwise. + */ + return (node !== null && algorithm_1.node_equals(this, node)); + }; + /** + * Determines if the given node is reference equal to this one. + * + * @param node - the node to compare with + */ + NodeImpl.prototype.isSameNode = function (node) { + if (node === void 0) { node = null; } + /** + * The isSameNode(otherNode) method, when invoked, must return true if + * otherNode is context object, and false otherwise. + */ + return (this === node); + }; + /** + * Returns a bitmask indicating the position of the given `node` + * relative to this node. + */ + NodeImpl.prototype.compareDocumentPosition = function (other) { + /** + * 1. If context object is other, then return zero. + * 2. Let node1 be other and node2 be context object. + * 3. Let attr1 and attr2 be null. + * attr1’s element. + */ + if (other === this) + return 0; + var node1 = other; + var node2 = this; + var attr1 = null; + var attr2 = null; + /** + * 4. If node1 is an attribute, then set attr1 to node1 and node1 to + * attr1’s element. + */ + if (util_1.Guard.isAttrNode(node1)) { + attr1 = node1; + node1 = attr1._element; + } + /** + * 5. If node2 is an attribute, then: + */ + if (util_1.Guard.isAttrNode(node2)) { + /** + * 5.1. Set attr2 to node2 and node2 to attr2’s element. + */ + attr2 = node2; + node2 = attr2._element; + /** + * 5.2. If attr1 and node1 are non-null, and node2 is node1, then: + */ + if (attr1 && node1 && (node1 === node2)) { + /** + * 5.2. For each attr in node2’s attribute list: + */ + for (var i = 0; i < node2._attributeList.length; i++) { + var attr = node2._attributeList[i]; + /** + * 5.2.1. If attr equals attr1, then return the result of adding + * DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC and + * DOCUMENT_POSITION_PRECEDING. + * 5.2.2. If attr equals attr2, then return the result of adding + * DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC and + * DOCUMENT_POSITION_FOLLOWING. + */ + if (algorithm_1.node_equals(attr, attr1)) { + return interfaces_1.Position.ImplementationSpecific | interfaces_1.Position.Preceding; + } + else if (algorithm_1.node_equals(attr, attr2)) { + return interfaces_1.Position.ImplementationSpecific | interfaces_1.Position.Following; + } + } + } + } + /** + * 6. If node1 or node2 is null, or node1’s root is not node2’s root, then + * return the result of adding DOCUMENT_POSITION_DISCONNECTED, + * DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, and either + * DOCUMENT_POSITION_PRECEDING or DOCUMENT_POSITION_FOLLOWING, + * with the constraint that this is to be consistent, together. + */ + if (node1 === null || node2 === null || + algorithm_1.tree_rootNode(node1) !== algorithm_1.tree_rootNode(node2)) { + // nodes are disconnected + // return a random result but cache the value for consistency + return interfaces_1.Position.Disconnected | interfaces_1.Position.ImplementationSpecific | + (DOMImpl_1.dom.compareCache.check(this, other) ? interfaces_1.Position.Preceding : interfaces_1.Position.Following); + } + /** + * 7. If node1 is an ancestor of node2 and attr1 is null, or node1 is node2 + * and attr2 is non-null, then return the result of adding + * DOCUMENT_POSITION_CONTAINS to DOCUMENT_POSITION_PRECEDING. + */ + if ((!attr1 && algorithm_1.tree_isAncestorOf(node2, node1)) || + (attr2 && (node1 === node2))) { + return interfaces_1.Position.Contains | interfaces_1.Position.Preceding; + } + /** + * 8. If node1 is a descendant of node2 and attr2 is null, or node1 is node2 + * and attr1 is non-null, then return the result of adding + * DOCUMENT_POSITION_CONTAINED_BY to DOCUMENT_POSITION_FOLLOWING. + */ + if ((!attr2 && algorithm_1.tree_isDescendantOf(node2, node1)) || + (attr1 && (node1 === node2))) { + return interfaces_1.Position.ContainedBy | interfaces_1.Position.Following; + } + /** + * 9. If node1 is preceding node2, then return DOCUMENT_POSITION_PRECEDING. + */ + if (algorithm_1.tree_isPreceding(node2, node1)) + return interfaces_1.Position.Preceding; + /** + * 10. Return DOCUMENT_POSITION_FOLLOWING. + */ + return interfaces_1.Position.Following; + }; + /** + * Returns `true` if given node is an inclusive descendant of this + * node, and `false` otherwise (including when other node is `null`). + * + * @param other - the node to check + */ + NodeImpl.prototype.contains = function (other) { + /** + * The contains(other) method, when invoked, must return true if other is an + * inclusive descendant of context object, and false otherwise (including + * when other is null). + */ + if (other === null) + return false; + return algorithm_1.tree_isDescendantOf(this, other, true); + }; + /** + * Returns the prefix for a given namespace URI, if present, and + * `null` if not. + * + * @param namespace - the namespace to search + */ + NodeImpl.prototype.lookupPrefix = function (namespace) { + /** + * 1. If namespace is null or the empty string, then return null. + * 2. Switch on the context object: + */ + if (!namespace) + return null; + if (util_1.Guard.isElementNode(this)) { + /** + * Return the result of locating a namespace prefix for it using + * namespace. + */ + return algorithm_1.node_locateANamespacePrefix(this, namespace); + } + else if (util_1.Guard.isDocumentNode(this)) { + /** + * Return the result of locating a namespace prefix for its document + * element, if its document element is non-null, and null otherwise. + */ + if (this.documentElement === null) { + return null; + } + else { + return algorithm_1.node_locateANamespacePrefix(this.documentElement, namespace); + } + } + else if (util_1.Guard.isDocumentTypeNode(this) || util_1.Guard.isDocumentFragmentNode(this)) { + return null; + } + else if (util_1.Guard.isAttrNode(this)) { + /** + * Return the result of locating a namespace prefix for its element, + * if its element is non-null, and null otherwise. + */ + if (this._element === null) { + return null; + } + else { + return algorithm_1.node_locateANamespacePrefix(this._element, namespace); + } + } + else { + /** + * Return the result of locating a namespace prefix for its parent + * element, if its parent element is non-null, and null otherwise. + */ + if (this._parent !== null && util_1.Guard.isElementNode(this._parent)) { + return algorithm_1.node_locateANamespacePrefix(this._parent, namespace); + } + else { + return null; + } + } + }; + /** + * Returns the namespace URI for a given prefix if present, and `null` + * if not. + * + * @param prefix - the prefix to search + */ + NodeImpl.prototype.lookupNamespaceURI = function (prefix) { + /** + * 1. If prefix is the empty string, then set it to null. + * 2. Return the result of running locate a namespace for the context object + * using prefix. + */ + return algorithm_1.node_locateANamespace(this, prefix || null); + }; + /** + * Returns `true` if the namespace is the default namespace on this + * node or `false` if not. + * + * @param namespace - the namespace to check + */ + NodeImpl.prototype.isDefaultNamespace = function (namespace) { + /** + * 1. If namespace is the empty string, then set it to null. + * 2. Let defaultNamespace be the result of running locate a namespace for + * context object using null. + * 3. Return true if defaultNamespace is the same as namespace, and false otherwise. + */ + if (!namespace) + namespace = null; + var defaultNamespace = algorithm_1.node_locateANamespace(this, null); + return (defaultNamespace === namespace); + }; + /** + * Inserts the node `newChild` before the existing child node + * `refChild`. If `refChild` is `null`, inserts `newChild` at the end + * of the list of children. + * + * If `newChild` is a {@link DocumentFragment} object, all of its + * children are inserted, in the same order, before `refChild`. + * + * If `newChild` is already in the tree, it is first removed. + * + * @param newChild - the node to insert + * @param refChild - the node before which the new node must be + * inserted + * + * @returns the newly inserted child node + */ + NodeImpl.prototype.insertBefore = function (newChild, refChild) { + /** + * The insertBefore(node, child) method, when invoked, must return the + * result of pre-inserting node into context object before child. + */ + return algorithm_1.mutation_preInsert(newChild, this, refChild); + }; + /** + * Adds the node `newChild` to the end of the list of children of this + * node, and returns it. If `newChild` is already in the tree, it is + * first removed. + * + * If `newChild` is a {@link DocumentFragment} object, the entire + * contents of the document fragment are moved into the child list of + * this node. + * + * @param newChild - the node to add + * + * @returns the newly inserted child node + */ + NodeImpl.prototype.appendChild = function (newChild) { + /** + * The appendChild(node) method, when invoked, must return the result of + * appending node to context object. + */ + return algorithm_1.mutation_append(newChild, this); + }; + /** + * Replaces the child node `oldChild` with `newChild` in the list of + * children, and returns the `oldChild` node. If `newChild` is already + * in the tree, it is first removed. + * + * @param newChild - the new node to put in the child list + * @param oldChild - the node being replaced in the list + * + * @returns the removed child node + */ + NodeImpl.prototype.replaceChild = function (newChild, oldChild) { + /** + * The replaceChild(node, child) method, when invoked, must return the + * result of replacing child with node within context object. + */ + return algorithm_1.mutation_replace(oldChild, newChild, this); + }; + /** + * Removes the child node indicated by `oldChild` from the list of + * children, and returns it. + * + * @param oldChild - the node being removed from the list + * + * @returns the removed child node + */ + NodeImpl.prototype.removeChild = function (oldChild) { + /** + * The removeChild(child) method, when invoked, must return the result of + * pre-removing child from context object. + */ + return algorithm_1.mutation_preRemove(oldChild, this); + }; + /** + * Gets the parent event target for the given event. + * + * @param event - an event + */ + NodeImpl.prototype._getTheParent = function (event) { + /** + * A node’s get the parent algorithm, given an event, returns the node’s + * assigned slot, if node is assigned, and node’s parent otherwise. + */ + if (util_1.Guard.isSlotable(this) && algorithm_1.shadowTree_isAssigned(this)) { + return this._assignedSlot; + } + else { + return this._parent; + } + }; + NodeImpl.ELEMENT_NODE = 1; + NodeImpl.ATTRIBUTE_NODE = 2; + NodeImpl.TEXT_NODE = 3; + NodeImpl.CDATA_SECTION_NODE = 4; + NodeImpl.ENTITY_REFERENCE_NODE = 5; + NodeImpl.ENTITY_NODE = 6; + NodeImpl.PROCESSING_INSTRUCTION_NODE = 7; + NodeImpl.COMMENT_NODE = 8; + NodeImpl.DOCUMENT_NODE = 9; + NodeImpl.DOCUMENT_TYPE_NODE = 10; + NodeImpl.DOCUMENT_FRAGMENT_NODE = 11; + NodeImpl.NOTATION_NODE = 12; + NodeImpl.DOCUMENT_POSITION_DISCONNECTED = 0x01; + NodeImpl.DOCUMENT_POSITION_PRECEDING = 0x02; + NodeImpl.DOCUMENT_POSITION_FOLLOWING = 0x04; + NodeImpl.DOCUMENT_POSITION_CONTAINS = 0x08; + NodeImpl.DOCUMENT_POSITION_CONTAINED_BY = 0x10; + NodeImpl.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; + return NodeImpl; +}(EventTargetImpl_1.EventTargetImpl)); +exports.NodeImpl = NodeImpl; +/** + * A performance tweak to share an empty set between all node classes. This will + * be overwritten by element, document and document fragment nodes to supply an + * actual set of nodes. + */ +NodeImpl.prototype._children = new util_1.EmptySet(); +/** + * Define constants on prototype. + */ +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "ELEMENT_NODE", 1); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "ATTRIBUTE_NODE", 2); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "TEXT_NODE", 3); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "CDATA_SECTION_NODE", 4); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "ENTITY_REFERENCE_NODE", 5); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "ENTITY_NODE", 6); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "PROCESSING_INSTRUCTION_NODE", 7); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "COMMENT_NODE", 8); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_NODE", 9); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_TYPE_NODE", 10); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_FRAGMENT_NODE", 11); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "NOTATION_NODE", 12); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_DISCONNECTED", 0x01); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_PRECEDING", 0x02); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_FOLLOWING", 0x04); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_CONTAINS", 0x08); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_CONTAINED_BY", 0x10); +WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", 0x20); +//# sourceMappingURL=NodeImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/NodeImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/NodeImpl.js.map new file mode 100644 index 0000000..c6cbbd7 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NodeImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NodeImpl.js","sourceRoot":"","sources":["../../src/dom/NodeImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAA+B;AAC/B,2CAIqB;AACrB,qDAAmD;AACnD,gCAAyC;AACzC,+CAAkD;AAClD,0CASqB;AACrB,+DAA8D;AAC9D,gEAA8D;AAE9D;;GAEG;AACH;IAAuC,4BAAe;IAgEpD;;OAEG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,EAAE,aAAa,EAAE,CAAC,CAAC,CAAA;AACrD,iCAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,6BAA6B,EAAE,CAAC,CAAC,CAAA;AACrE,iCAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,cAAc,EAAE,CAAC,CAAC,CAAA;AACtD,iCAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC,CAAA;AACvD,iCAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,oBAAoB,EAAE,EAAE,CAAC,CAAA;AAC7D,iCAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,wBAAwB,EAAE,EAAE,CAAC,CAAA;AACjE,iCAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,eAAe,EAAE,EAAE,CAAC,CAAA;AAExD,iCAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,gCAAgC,EAAE,IAAI,CAAC,CAAA;AAC3E,iCAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,6BAA6B,EAAE,IAAI,CAAC,CAAA;AACxE,iCAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,6BAA6B,EAAE,IAAI,CAAC,CAAA;AACxE,iCAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,4BAA4B,EAAE,IAAI,CAAC,CAAA;AACvE,iCAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,gCAAgC,EAAE,IAAI,CAAC,CAAA;AAC3E,iCAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,2CAA2C,EAAE,IAAI,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/NodeIteratorImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/NodeIteratorImpl.d.ts new file mode 100644 index 0000000..b405e20 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NodeIteratorImpl.d.ts @@ -0,0 +1,34 @@ +import { Node, NodeIterator, Collection } from "./interfaces"; +import { TraverserImpl } from "./TraverserImpl"; +/** + * Represents an object which can be used to iterate through the nodes + * of a subtree. + */ +export declare class NodeIteratorImpl extends TraverserImpl implements NodeIterator { + _iteratorCollection: Collection; + _reference: Node; + _pointerBeforeReference: boolean; + /** + * Initializes a new instance of `NodeIterator`. + */ + private constructor(); + /** @inheritdoc */ + get referenceNode(): Node; + /** @inheritdoc */ + get pointerBeforeReferenceNode(): boolean; + /** @inheritdoc */ + nextNode(): Node | null; + /** @inheritdoc */ + previousNode(): Node | null; + /** @inheritdoc */ + detach(): void; + /** + * Creates a new `NodeIterator`. + * + * @param root - iterator's root node + * @param reference - reference node + * @param pointerBeforeReference - whether the iterator is before or after the + * reference node + */ + static _create(root: Node, reference: Node, pointerBeforeReference: boolean): NodeIteratorImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/NodeIteratorImpl.js b/node_modules/@oozcitak/dom/lib/dom/NodeIteratorImpl.js new file mode 100644 index 0000000..a655467 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NodeIteratorImpl.js @@ -0,0 +1,86 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var TraverserImpl_1 = require("./TraverserImpl"); +var algorithm_1 = require("../algorithm"); +/** + * Represents an object which can be used to iterate through the nodes + * of a subtree. + */ +var NodeIteratorImpl = /** @class */ (function (_super) { + __extends(NodeIteratorImpl, _super); + /** + * Initializes a new instance of `NodeIterator`. + */ + function NodeIteratorImpl(root, reference, pointerBeforeReference) { + var _this = _super.call(this, root) || this; + _this._iteratorCollection = undefined; + _this._reference = reference; + _this._pointerBeforeReference = pointerBeforeReference; + algorithm_1.nodeIterator_iteratorList().add(_this); + return _this; + } + Object.defineProperty(NodeIteratorImpl.prototype, "referenceNode", { + /** @inheritdoc */ + get: function () { return this._reference; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NodeIteratorImpl.prototype, "pointerBeforeReferenceNode", { + /** @inheritdoc */ + get: function () { return this._pointerBeforeReference; }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + NodeIteratorImpl.prototype.nextNode = function () { + /** + * The nextNode() method, when invoked, must return the result of + * traversing with the context object and next. + */ + return algorithm_1.nodeIterator_traverse(this, true); + }; + /** @inheritdoc */ + NodeIteratorImpl.prototype.previousNode = function () { + /** + * The previousNode() method, when invoked, must return the result of + * traversing with the context object and previous. + */ + return algorithm_1.nodeIterator_traverse(this, false); + }; + /** @inheritdoc */ + NodeIteratorImpl.prototype.detach = function () { + /** + * The detach() method, when invoked, must do nothing. + * + * since JS lacks weak references, we still use detach + */ + algorithm_1.nodeIterator_iteratorList().delete(this); + }; + /** + * Creates a new `NodeIterator`. + * + * @param root - iterator's root node + * @param reference - reference node + * @param pointerBeforeReference - whether the iterator is before or after the + * reference node + */ + NodeIteratorImpl._create = function (root, reference, pointerBeforeReference) { + return new NodeIteratorImpl(root, reference, pointerBeforeReference); + }; + return NodeIteratorImpl; +}(TraverserImpl_1.TraverserImpl)); +exports.NodeIteratorImpl = NodeIteratorImpl; +//# sourceMappingURL=NodeIteratorImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/NodeIteratorImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/NodeIteratorImpl.js.map new file mode 100644 index 0000000..5248038 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NodeIteratorImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NodeIteratorImpl.js","sourceRoot":"","sources":["../../src/dom/NodeIteratorImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iDAA+C;AAC/C,0CAA+E;AAE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index 0000000..78c8b01 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NodeListImpl.d.ts @@ -0,0 +1,46 @@ +import { Node, NodeList } from "./interfaces"; +/** + * Represents an ordered set of nodes. + */ +export declare class NodeListImpl implements NodeList { + _live: boolean; + _root: Node; + _filter: ((node: Node) => any) | null; + _length: number; + /** + * Initializes a new instance of `NodeList`. + * + * @param root - root node + */ + private constructor(); + /** @inheritdoc */ + get length(): number; + /** @inheritdoc */ + item(index: number): Node | null; + /** @inheritdoc */ + [index: number]: Node | undefined; + /** @inheritdoc */ + keys(): Iterable; + /** @inheritdoc */ + values(): Iterable; + /** @inheritdoc */ + entries(): Iterable<[number, Node]>; + /** @inheritdoc */ + [Symbol.iterator](): Iterator; + /** @inheritdoc */ + forEach(callback: ((node: Node, index: number, list: NodeList) => any), thisArg?: any): void; + /** + * Implements a proxy get trap to provide array-like access. + */ + get(target: NodeList, key: PropertyKey, receiver: any): Node | undefined; + /** + * Implements a proxy set trap to provide array-like access. + */ + set(target: NodeList, key: PropertyKey, value: Node, receiver: any): boolean; + /** + * Creates a new `NodeList`. + * + * @param root - root node + */ + static _create(root: Node): NodeListImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/NodeListImpl.js b/node_modules/@oozcitak/dom/lib/dom/NodeListImpl.js new file mode 100644 index 0000000..e812ab2 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NodeListImpl.js @@ -0,0 +1,198 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("./DOMImpl"); +var util_1 = require("@oozcitak/util"); +var algorithm_1 = require("../algorithm"); +/** + * Represents an ordered set of nodes. + */ +var NodeListImpl = /** @class */ (function () { + /** + * Initializes a new instance of `NodeList`. + * + * @param root - root node + */ + function NodeListImpl(root) { + this._live = true; + this._filter = null; + this._length = 0; + this._root = root; + return new Proxy(this, this); + } + Object.defineProperty(NodeListImpl.prototype, "length", { + /** @inheritdoc */ + get: function () { + /** + * The length attribute must return the number of nodes represented + * by the collection. + */ + return this._root._children.size; + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + NodeListImpl.prototype.item = function (index) { + /** + * The item(index) method must return the indexth node in the collection. + * If there is no indexth node in the collection, then the method must + * return null. + */ + if (index < 0 || index > this.length - 1) + return null; + if (index < this.length / 2) { + var i = 0; + var node = this._root._firstChild; + while (node !== null && i !== index) { + node = node._nextSibling; + i++; + } + return node; + } + else { + var i = this.length - 1; + var node = this._root._lastChild; + while (node !== null && i !== index) { + node = node._previousSibling; + i--; + } + return node; + } + }; + /** @inheritdoc */ + NodeListImpl.prototype.keys = function () { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + var index = 0; + return { + next: function () { + if (index === this.length) { + return { done: true, value: null }; + } + else { + return { done: false, value: index++ }; + } + }.bind(this) + }; + }.bind(this), + _a; + }; + /** @inheritdoc */ + NodeListImpl.prototype.values = function () { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + var it = this[Symbol.iterator](); + return { + next: function () { + return it.next(); + } + }; + }.bind(this), + _a; + }; + /** @inheritdoc */ + NodeListImpl.prototype.entries = function () { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + var it = this[Symbol.iterator](); + var index = 0; + return { + next: function () { + var itResult = it.next(); + if (itResult.done) { + return { done: true, value: null }; + } + else { + return { done: false, value: [index++, itResult.value] }; + } + } + }; + }.bind(this), + _a; + }; + /** @inheritdoc */ + NodeListImpl.prototype[Symbol.iterator] = function () { + return this._root._children[Symbol.iterator](); + }; + /** @inheritdoc */ + NodeListImpl.prototype.forEach = function (callback, thisArg) { + var e_1, _a; + if (thisArg === undefined) { + thisArg = DOMImpl_1.dom.window; + } + var index = 0; + try { + for (var _b = __values(this._root._children), _c = _b.next(); !_c.done; _c = _b.next()) { + var node = _c.value; + callback.call(thisArg, node, index++, this); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + }; + /** + * Implements a proxy get trap to provide array-like access. + */ + NodeListImpl.prototype.get = function (target, key, receiver) { + if (!util_1.isString(key)) { + return Reflect.get(target, key, receiver); + } + var index = Number(key); + if (isNaN(index)) { + return Reflect.get(target, key, receiver); + } + return target.item(index) || undefined; + }; + /** + * Implements a proxy set trap to provide array-like access. + */ + NodeListImpl.prototype.set = function (target, key, value, receiver) { + if (!util_1.isString(key)) { + return Reflect.set(target, key, value, receiver); + } + var index = Number(key); + if (isNaN(index)) { + return Reflect.set(target, key, value, receiver); + } + var node = target.item(index) || undefined; + if (!node) + return false; + if (node._parent) { + algorithm_1.mutation_replace(node, value, node._parent); + return true; + } + else { + return false; + } + }; + /** + * Creates a new `NodeList`. + * + * @param root - root node + */ + NodeListImpl._create = function (root) { + return new NodeListImpl(root); + }; + return NodeListImpl; +}()); +exports.NodeListImpl = NodeListImpl; +//# sourceMappingURL=NodeListImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/NodeListImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/NodeListImpl.js.map new file mode 100644 index 0000000..96882bd --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NodeListImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NodeListImpl.js","sourceRoot":"","sources":["../../src/dom/NodeListImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAA+B;AAE/B,uCAAyC;AACzC,0CAA+C;AAE/C;;GAEG;AACH;IAOE;;;;OAIG;IACH,sBAAoB,IAAU;QAV9B,UAAK,GAAY,IAAI,CAAA;QAErB,YAAO,GAAiC,IAAI,C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AC,CAAA;SACjD;QAED,IAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;QACzB,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE;YAChB,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA;SACjD;QAED,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,SAAS,CAAA;QAC5C,IAAI,CAAC,IAAI;YAAE,OAAO,KAAK,CAAA;QAEvB,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,4BAAgB,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;YAC3C,OAAO,IAAI,CAAA;SACZ;aAAM;YACL,OAAO,KAAK,CAAA;SACb;IACH,CAAC;IAED;;;;OAIG;IACI,oBAAO,GAAd,UAAe,IAAU;QACvB,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,CAAA;IAC/B,CAAC;IACH,mBAAC;AAAD,CAAC,AAtLD,IAsLC;AAtLY,oCAAY"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/NodeListStaticImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/NodeListStaticImpl.d.ts new file mode 100644 index 0000000..7323842 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NodeListStaticImpl.d.ts @@ -0,0 +1,49 @@ +import { Node, NodeList } from "./interfaces"; +/** + * Represents an ordered list of nodes. + * This is a static implementation of `NodeList`. + */ +export declare class NodeListStaticImpl implements NodeList { + _live: boolean; + _root: Node; + _filter: ((element: Node) => any); + _items: Node[]; + _length: number; + /** + * Initializes a new instance of `NodeList`. + * + * @param root - root node + */ + private constructor(); + /** @inheritdoc */ + get length(): number; + /** @inheritdoc */ + item(index: number): Node | null; + /** @inheritdoc */ + [index: number]: Node | undefined; + /** @inheritdoc */ + keys(): Iterable; + /** @inheritdoc */ + values(): Iterable; + /** @inheritdoc */ + entries(): Iterable<[number, Node]>; + /** @inheritdoc */ + [Symbol.iterator](): Iterator; + /** @inheritdoc */ + forEach(callback: (node: Node, index: number, list: NodeList) => any, thisArg?: any): void; + /** + * Implements a proxy get trap to provide array-like access. + */ + get(target: NodeListStaticImpl, key: PropertyKey, receiver: any): Node | undefined; + /** + * Implements a proxy set trap to provide array-like access. + */ + set(target: NodeListStaticImpl, key: PropertyKey, value: Node, receiver: any): boolean; + /** + * Creates a new `NodeList`. + * + * @param root - root node + * @param items - a list of items to initialize the list + */ + static _create(root: Node, items: Node[]): NodeListStaticImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/NodeListStaticImpl.js b/node_modules/@oozcitak/dom/lib/dom/NodeListStaticImpl.js new file mode 100644 index 0000000..40326b7 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NodeListStaticImpl.js @@ -0,0 +1,188 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("./DOMImpl"); +var util_1 = require("@oozcitak/util"); +/** + * Represents an ordered list of nodes. + * This is a static implementation of `NodeList`. + */ +var NodeListStaticImpl = /** @class */ (function () { + /** + * Initializes a new instance of `NodeList`. + * + * @param root - root node + */ + function NodeListStaticImpl(root) { + this._live = false; + this._items = []; + this._length = 0; + this._root = root; + this._items = []; + this._filter = function (node) { return true; }; + return new Proxy(this, this); + } + Object.defineProperty(NodeListStaticImpl.prototype, "length", { + /** @inheritdoc */ + get: function () { + /** + * The length attribute must return the number of nodes represented by + * the collection. + */ + return this._items.length; + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + NodeListStaticImpl.prototype.item = function (index) { + /** + * The item(index) method must return the indexth node in the collection. + * If there is no indexth node in the collection, then the method must + * return null. + */ + if (index < 0 || index > this.length - 1) + return null; + return this._items[index]; + }; + /** @inheritdoc */ + NodeListStaticImpl.prototype.keys = function () { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + var index = 0; + return { + next: function () { + if (index === this.length) { + return { done: true, value: null }; + } + else { + return { done: false, value: index++ }; + } + }.bind(this) + }; + }.bind(this), + _a; + }; + /** @inheritdoc */ + NodeListStaticImpl.prototype.values = function () { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + var it = this[Symbol.iterator](); + return { + next: function () { + return it.next(); + } + }; + }.bind(this), + _a; + }; + /** @inheritdoc */ + NodeListStaticImpl.prototype.entries = function () { + var _a; + return _a = {}, + _a[Symbol.iterator] = function () { + var it = this[Symbol.iterator](); + var index = 0; + return { + next: function () { + var itResult = it.next(); + if (itResult.done) { + return { done: true, value: null }; + } + else { + return { done: false, value: [index++, itResult.value] }; + } + } + }; + }.bind(this), + _a; + }; + /** @inheritdoc */ + NodeListStaticImpl.prototype[Symbol.iterator] = function () { + var it = this._items[Symbol.iterator](); + return { + next: function () { + return it.next(); + } + }; + }; + /** @inheritdoc */ + NodeListStaticImpl.prototype.forEach = function (callback, thisArg) { + var e_1, _a; + if (thisArg === undefined) { + thisArg = DOMImpl_1.dom.window; + } + var index = 0; + try { + for (var _b = __values(this._items), _c = _b.next(); !_c.done; _c = _b.next()) { + var node = _c.value; + callback.call(thisArg, node, index++, this); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + }; + /** + * Implements a proxy get trap to provide array-like access. + */ + NodeListStaticImpl.prototype.get = function (target, key, receiver) { + if (!util_1.isString(key)) { + return Reflect.get(target, key, receiver); + } + var index = Number(key); + if (isNaN(index)) { + return Reflect.get(target, key, receiver); + } + return target._items[index] || undefined; + }; + /** + * Implements a proxy set trap to provide array-like access. + */ + NodeListStaticImpl.prototype.set = function (target, key, value, receiver) { + if (!util_1.isString(key)) { + return Reflect.set(target, key, value, receiver); + } + var index = Number(key); + if (isNaN(index)) { + return Reflect.set(target, key, value, receiver); + } + if (index >= 0 && index < target._items.length) { + target._items[index] = value; + return true; + } + else { + return false; + } + }; + /** + * Creates a new `NodeList`. + * + * @param root - root node + * @param items - a list of items to initialize the list + */ + NodeListStaticImpl._create = function (root, items) { + var list = new NodeListStaticImpl(root); + list._items = items; + return list; + }; + return NodeListStaticImpl; +}()); +exports.NodeListStaticImpl = NodeListStaticImpl; +//# sourceMappingURL=NodeListStaticImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/NodeListStaticImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/NodeListStaticImpl.js.map new file mode 100644 index 0000000..a6def98 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NodeListStaticImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NodeListStaticImpl.js","sourceRoot":"","sources":["../../src/dom/NodeListStaticImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAA+B;AAE/B,uCAAyC;AAEzC;;;GAGG;AACH;IAQE;;;;OAIG;IACH,4BAAoB,IAAU;QAX9B,UAAK,GAAY,KAAK,CAAA;QAGtB,WAAM,GAAW,EAAE,CAAA;QACnB,YAAO,GAAG,CAAC,CAAA;QAQT,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,UAAU,IAAU,IAAI,OAAO,IAAI,CAAA,CAAC,CAAC,CAAA;QAEpD,OAAO,IAAI,KAAK,CAAqB,IAAI,EAAE,IAAI,CAAC,CAAA;IAClD,CAAC;IAGD,sBAAI,sCAAM;QADV,kBAAkB;aAClB;YACE;;;eAGG;YACH,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;QAC3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eChildNodeImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/NonDocumentTypeChildNodeImpl.d.ts new file mode 100644 index 0000000..b42abf4 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NonDocumentTypeChildNodeImpl.d.ts @@ -0,0 +1,12 @@ +import { Element, NonDocumentTypeChildNode } from "./interfaces"; +/** + * Represents a mixin that extends child nodes that can have siblings + * other than doctypes. This mixin is implemented by {@link Element} and + * {@link CharacterData}. + */ +export declare class NonDocumentTypeChildNodeImpl implements NonDocumentTypeChildNode { + /** @inheritdoc */ + get previousElementSibling(): Element | null; + /** @inheritdoc */ + get nextElementSibling(): Element | null; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/NonDocumentTypeChildNodeImpl.js b/node_modules/@oozcitak/dom/lib/dom/NonDocumentTypeChildNodeImpl.js new file mode 100644 index 0000000..debca7a --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NonDocumentTypeChildNodeImpl.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var util_1 = require("../util"); +/** + * Represents a mixin that extends child nodes that can have siblings + * other than doctypes. This mixin is implemented by {@link Element} and + * {@link CharacterData}. + */ +var NonDocumentTypeChildNodeImpl = /** @class */ (function () { + function NonDocumentTypeChildNodeImpl() { + } + Object.defineProperty(NonDocumentTypeChildNodeImpl.prototype, "previousElementSibling", { + /** @inheritdoc */ + get: function () { + /** + * The previousElementSibling attribute’s getter must return the first + * preceding sibling that is an element, and null otherwise. + */ + var node = util_1.Cast.asNode(this)._previousSibling; + while (node) { + if (util_1.Guard.isElementNode(node)) + return node; + else + node = node._previousSibling; + } + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NonDocumentTypeChildNodeImpl.prototype, "nextElementSibling", { + /** @inheritdoc */ + get: function () { + /** + * The nextElementSibling attribute’s getter must return the first + * following sibling that is an element, and null otherwise. + */ + var node = util_1.Cast.asNode(this)._nextSibling; + while (node) { + if (util_1.Guard.isElementNode(node)) + return node; + else + node = node._nextSibling; + } + return null; + }, + enumerable: true, + configurable: true + }); + return NonDocumentTypeChildNodeImpl; +}()); +exports.NonDocumentTypeChildNodeImpl = NonDocumentTypeChildNodeImpl; +//# sourceMappingURL=NonDocumentTypeChildNodeImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/NonDocumentTypeChildNodeImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/NonDocumentTypeChildNodeImpl.js.map new file mode 100644 index 0000000..ca51930 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NonDocumentTypeChildNodeImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NonDocumentTypeChildNodeImpl.js","sourceRoot":"","sources":["../../src/dom/NonDocumentTypeChildNodeImpl.ts"],"names":[],"mappings":";;AACA,gCAAqC;AAErC;;;;GAIG;AACH;IAAA;IAkCA,CAAC;IA/BC,sBAAI,gEAAsB;QAD1B,kBAAkB;aAClB;YACE;;;eAGG;YACH,IAAI,IAAI,GAAG,WAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAA;YAC7C,OAAO,IAAI,EAAE;gBACX,IAAI,YAAK,CAAC,aAAa,CAAC,IAAI,CAAC;oBAC3B,OAAO,IAAI,CAAA;;oBAEX,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAA;aAC/B;YACD,OAAO,IAAI,CAAA;QACb,CAAC;;;OAAA;IAGD,sBAAI,4DAAkB;QADtB,kBAAkB;aAClB;YACE;;;eAGG;YACH,IAAI,IAAI,GAAG,WAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,YAAY,CAAA;YACzC,OAAO,IAAI,EAAE;gBACX,IAAI,YAAK,CAAC,aAAa,CAAC,IAAI,CAAC;oBAC3B,OAAO,IAAI,CAAA;;oBAEX,IAAI,GAAG,IAAI,CAAC,YAAY,CAAA;aAC3B;YACD,OAAO,IAAI,CAAA;QACb,CAAC;;;OAAA;IAEH,mCAAC;AAAD,CAAC,AAlCD,IAkCC;AAlCY,oEAA4B"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/NonElementParentNodeImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/NonElementParentNodeImpl.d.ts new file mode 100644 index 0000000..b3860b0 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NonElementParentNodeImpl.d.ts @@ -0,0 +1,9 @@ +import { Element, NonElementParentNode } from "./interfaces"; +/** + * Represents a mixin that extends non-element parent nodes. This mixin + * is implemented by {@link Document} and {@link DocumentFragment}. + */ +export declare class NonElementParentNodeImpl implements NonElementParentNode { + /** @inheritdoc */ + getElementById(id: string): Element | null; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/NonElementParentNodeImpl.js b/node_modules/@oozcitak/dom/lib/dom/NonElementParentNodeImpl.js new file mode 100644 index 0000000..79f19bd --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NonElementParentNodeImpl.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var util_1 = require("../util"); +var algorithm_1 = require("../algorithm"); +/** + * Represents a mixin that extends non-element parent nodes. This mixin + * is implemented by {@link Document} and {@link DocumentFragment}. + */ +var NonElementParentNodeImpl = /** @class */ (function () { + function NonElementParentNodeImpl() { + } + /** @inheritdoc */ + NonElementParentNodeImpl.prototype.getElementById = function (id) { + /** + * The getElementById(elementId) method, when invoked, must return the first + * element, in tree order, within the context object’s descendants, + * whose ID is elementId, and null if there is no such element otherwise. + */ + var ele = algorithm_1.tree_getFirstDescendantNode(util_1.Cast.asNode(this), false, false, function (e) { return util_1.Guard.isElementNode(e); }); + while (ele !== null) { + if (ele._uniqueIdentifier === id) { + return ele; + } + ele = algorithm_1.tree_getNextDescendantNode(util_1.Cast.asNode(this), ele, false, false, function (e) { return util_1.Guard.isElementNode(e); }); + } + return null; + }; + return NonElementParentNodeImpl; +}()); +exports.NonElementParentNodeImpl = NonElementParentNodeImpl; +//# sourceMappingURL=NonElementParentNodeImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/NonElementParentNodeImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/NonElementParentNodeImpl.js.map new file mode 100644 index 0000000..472edf8 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/NonElementParentNodeImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NonElementParentNodeImpl.js","sourceRoot":"","sources":["../../src/dom/NonElementParentNodeImpl.ts"],"names":[],"mappings":";;AACA,gCAAqC;AACrC,0CAAsF;AAEtF;;;GAGG;AACH;IAAA;IAsBA,CAAC;IApBC,kBAAkB;IAClB,iDAAc,GAAd,UAAe,EAAU;QACvB;;;;WAIG;QACH,IAAI,GAAG,GAAG,uCAA2B,CAAC,WAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EACnE,UAAC,CAAC,IAAK,OAAA,YAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EAAtB,CAAsB,CAAmB,CAAA;QAClD,OAAO,GAAG,KAAK,IAAI,EAAE;YACnB,IAAI,GAAG,CAAC,iBAAiB,KAAK,EAAE,EAAE;gBAChC,OAAO,GAAG,CAAA;aACX;YACD,GAAG,GAAG,sCAA0B,CAAC,WAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EACnE,UAAC,CAAC,IAAK,OAAA,YAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EAAtB,CAAsB,CAAmB,CAAA;SACnD;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAEH,+BAAC;AAAD,CAAC,AAtBD,IAsBC;AAtBY,4DAAwB"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/ParentNodeImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/ParentNodeImpl.d.ts new file mode 100644 index 0000000..d6ff69a --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/ParentNodeImpl.d.ts @@ -0,0 +1,24 @@ +import { Node, HTMLCollection, NodeList, Element, ParentNode } from "./interfaces"; +/** + * Represents a mixin that extends parent nodes that can have children. + * This mixin is implemented by {@link Element}, {@link Document} and + * {@link DocumentFragment}. + */ +export declare class ParentNodeImpl implements ParentNode { + /** @inheritdoc */ + get children(): HTMLCollection; + /** @inheritdoc */ + get firstElementChild(): Element | null; + /** @inheritdoc */ + get lastElementChild(): Element | null; + /** @inheritdoc */ + get childElementCount(): number; + /** @inheritdoc */ + prepend(...nodes: (Node | string)[]): void; + /** @inheritdoc */ + append(...nodes: (Node | string)[]): void; + /** @inheritdoc */ + querySelector(selectors: string): Element | null; + /** @inheritdoc */ + querySelectorAll(selectors: string): NodeList; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/ParentNodeImpl.js b/node_modules/@oozcitak/dom/lib/dom/ParentNodeImpl.js new file mode 100644 index 0000000..288618b --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/ParentNodeImpl.js @@ -0,0 +1,158 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var util_1 = require("../util"); +var algorithm_1 = require("../algorithm"); +/** + * Represents a mixin that extends parent nodes that can have children. + * This mixin is implemented by {@link Element}, {@link Document} and + * {@link DocumentFragment}. + */ +var ParentNodeImpl = /** @class */ (function () { + function ParentNodeImpl() { + } + Object.defineProperty(ParentNodeImpl.prototype, "children", { + /** @inheritdoc */ + get: function () { + /** + * The children attribute’s getter must return an HTMLCollection collection + * rooted at context object matching only element children. + */ + return algorithm_1.create_htmlCollection(util_1.Cast.asNode(this)); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ParentNodeImpl.prototype, "firstElementChild", { + /** @inheritdoc */ + get: function () { + /** + * The firstElementChild attribute’s getter must return the first child + * that is an element, and null otherwise. + */ + var node = util_1.Cast.asNode(this)._firstChild; + while (node) { + if (util_1.Guard.isElementNode(node)) + return node; + else + node = node._nextSibling; + } + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ParentNodeImpl.prototype, "lastElementChild", { + /** @inheritdoc */ + get: function () { + /** + * The lastElementChild attribute’s getter must return the last child that + * is an element, and null otherwise. + */ + var node = util_1.Cast.asNode(this)._lastChild; + while (node) { + if (util_1.Guard.isElementNode(node)) + return node; + else + node = node._previousSibling; + } + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ParentNodeImpl.prototype, "childElementCount", { + /** @inheritdoc */ + get: function () { + var e_1, _a; + /** + * The childElementCount attribute’s getter must return the number of + * children of context object that are elements. + */ + var count = 0; + try { + for (var _b = __values(util_1.Cast.asNode(this)._children), _c = _b.next(); !_c.done; _c = _b.next()) { + var childNode = _c.value; + if (util_1.Guard.isElementNode(childNode)) + count++; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + return count; + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + ParentNodeImpl.prototype.prepend = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + /** + * 1. Let node be the result of converting nodes into a node given nodes + * and context object’s node document. + * 2. Pre-insert node into context object before the context object’s first + * child. + */ + var node = util_1.Cast.asNode(this); + var childNode = algorithm_1.parentNode_convertNodesIntoANode(nodes, node._nodeDocument); + algorithm_1.mutation_preInsert(childNode, node, node._firstChild); + }; + /** @inheritdoc */ + ParentNodeImpl.prototype.append = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + /** + * 1. Let node be the result of converting nodes into a node given nodes + * and context object’s node document. + * 2. Append node to context object. + */ + var node = util_1.Cast.asNode(this); + var childNode = algorithm_1.parentNode_convertNodesIntoANode(nodes, node._nodeDocument); + algorithm_1.mutation_append(childNode, node); + }; + /** @inheritdoc */ + ParentNodeImpl.prototype.querySelector = function (selectors) { + /** + * The querySelector(selectors) method, when invoked, must return the first + * result of running scope-match a selectors string selectors against + * context object, if the result is not an empty list, and null otherwise. + */ + var node = util_1.Cast.asNode(this); + var result = algorithm_1.selectors_scopeMatchASelectorsString(selectors, node); + return (result.length === 0 ? null : result[0]); + }; + /** @inheritdoc */ + ParentNodeImpl.prototype.querySelectorAll = function (selectors) { + /** + * The querySelectorAll(selectors) method, when invoked, must return the + * static result of running scope-match a selectors string selectors against + * context object. + */ + var node = util_1.Cast.asNode(this); + var result = algorithm_1.selectors_scopeMatchASelectorsString(selectors, node); + return algorithm_1.create_nodeListStatic(node, result); + }; + return ParentNodeImpl; +}()); +exports.ParentNodeImpl = ParentNodeImpl; +//# sourceMappingURL=ParentNodeImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/ParentNodeImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/ParentNodeImpl.js.map new file mode 100644 index 0000000..16e7120 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/ParentNodeImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ParentNodeImpl.js","sourceRoot":"","sources":["../../src/dom/ParentNodeImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,gCAAqC;AACrC,0CAIqB;AAErB;;;;GAIG;AACH;IAAA;IAiHA,CAAC;IA9GC,sBAAI,oCAAQ;QADZ,kBAAkB;aAClB;YACE;;;eAGG;YACH,OAAO,iCAAqB,CAAC,WAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;QACjD,CAAC;;;OAAA;IAGD,sBAAI,6CAAiB;QADrB,kBAAkB;aAClB;YACE;;;eAGG;YACH,IAAI,IAAI,GAAG,WAAI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,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;IACvD,CAAC;IAED,kBAAkB;IAClB,+BAAM,GAAN;QAAO,eAA2B;aAA3B,UAA2B,EAA3B,qBAA2B,EAA3B,IAA2B;YAA3B,0BAA2B;;QAChC;;;;WAIG;QACH,IAAM,IAAI,GAAG,WAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAE9B,IAAM,SAAS,GAAG,4CAAgC,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,CAAA;QAC7E,2BAAe,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;IAClC,CAAC;IAED,kBAAkB;IAClB,sCAAa,GAAb,UAAc,SAAiB;QAC7B;;;;WAIG;QACH,IAAM,IAAI,GAAG,WAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAE9B,IAAM,MAAM,GAAG,gDAAoC,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;QACpE,OAAO,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IACjD,CAAC;IAED,kBAAkB;IAClB,yCAAgB,GAAhB,UAAiB,SAAiB;QAChC;;;;WAIG;QACH,IAAM,IAAI,GAAG,WAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAE9B,IAAM,MAAM,GAAG,gDAAoC,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;QACpE,OAAO,iCAAqB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAC5C,CAAC;IAEH,qBAAC;AAAD,CAAC,AAjHD,IAiHC;AAjHY,wCAAc"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/ProcessingInstructionImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/ProcessingInstructionImpl.d.ts new file mode 100644 index 0000000..ebc9331 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/ProcessingInstructionImpl.d.ts @@ -0,0 +1,25 @@ +import { NodeType, ProcessingInstruction, Document } from "./interfaces"; +import { CharacterDataImpl } from "./CharacterDataImpl"; +/** + * Represents a processing instruction node. + */ +export declare class ProcessingInstructionImpl extends CharacterDataImpl implements ProcessingInstruction { + _nodeType: NodeType; + _target: string; + /** + * Initializes a new instance of `ProcessingInstruction`. + */ + private constructor(); + /** + * Gets the target of the {@link ProcessingInstruction} node. + */ + get target(): string; + /** + * Creates a new `ProcessingInstruction`. + * + * @param document - owner document + * @param target - instruction target + * @param data - node contents + */ + static _create(document: Document, target: string, data: string): ProcessingInstructionImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/ProcessingInstructionImpl.js b/node_modules/@oozcitak/dom/lib/dom/ProcessingInstructionImpl.js new file mode 100644 index 0000000..02a2be2 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/ProcessingInstructionImpl.js @@ -0,0 +1,59 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("./interfaces"); +var CharacterDataImpl_1 = require("./CharacterDataImpl"); +var WebIDLAlgorithm_1 = require("../algorithm/WebIDLAlgorithm"); +/** + * Represents a processing instruction node. + */ +var ProcessingInstructionImpl = /** @class */ (function (_super) { + __extends(ProcessingInstructionImpl, _super); + /** + * Initializes a new instance of `ProcessingInstruction`. + */ + function ProcessingInstructionImpl(target, data) { + var _this = _super.call(this, data) || this; + _this._target = target; + return _this; + } + Object.defineProperty(ProcessingInstructionImpl.prototype, "target", { + /** + * Gets the target of the {@link ProcessingInstruction} node. + */ + get: function () { return this._target; }, + enumerable: true, + configurable: true + }); + /** + * Creates a new `ProcessingInstruction`. + * + * @param document - owner document + * @param target - instruction target + * @param data - node contents + */ + ProcessingInstructionImpl._create = function (document, target, data) { + var node = new ProcessingInstructionImpl(target, data); + node._nodeDocument = document; + return node; + }; + return ProcessingInstructionImpl; +}(CharacterDataImpl_1.CharacterDataImpl)); +exports.ProcessingInstructionImpl = ProcessingInstructionImpl; +/** + * Initialize prototype properties + */ +WebIDLAlgorithm_1.idl_defineConst(ProcessingInstructionImpl.prototype, "_nodeType", interfaces_1.NodeType.ProcessingInstruction); +//# sourceMappingURL=ProcessingInstructionImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/ProcessingInstructionImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/ProcessingInstructionImpl.js.map new file mode 100644 index 0000000..732ceb6 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/ProcessingInstructionImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ProcessingInstructionImpl.js","sourceRoot":"","sources":["../../src/dom/ProcessingInstructionImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwE;AACxE,yDAAuD;AACvD,gEAA8D;AAE9D;;GAEG;AACH;IAA+C,6CAAiB;IAM9D;;OAEG;IACH,mCAAoB,MAAc,EAAE,IAAY;QAAhD,YACE,kBAAM,IAAI,CAAC,SAGZ;QADC,KAAI,CAAC,OAAO,GAAG,MAAM,CAAA;;IACvB,CAAC;IAKD,sBAAI,6CAAM;QAHV;;WAEG;aACH,cAAuB,OAAO,IAAI,CAAC,OAAO,CAAA,CAAC,CAAC;;;OAAA;IAE5C;;;;;;OAMG;IACI,iCAAO,GAAd,UAAe,QAAkB,EAAE,MAAc,EAC/C,IAAY;QACZ,IAAM,IAAI,GAAG,IAAI,yBAAyB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QACxD,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAA;QAC7B,OAAO,IAAI,CAAA;IACb,CAAC;IAEH,gCAAC;AAAD,CAAC,AAlCD,CAA+C,qCAAiB,GAkC/D;AAlCY,8DAAyB;AAoCtC;;GAEG;AACH,iCAAe,CAAC,yBAAyB,CAAC,SAAS,EAAE,WAAW,EAAE,qBAAQ,CAAC,qBAAqB,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/RangeImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/RangeImpl.d.ts new file mode 100644 index 0000000..1d25993 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/RangeImpl.d.ts @@ -0,0 +1,71 @@ +import { Node, Range, HowToCompare, DocumentFragment, BoundaryPoint } from "./interfaces"; +import { AbstractRangeImpl } from "./AbstractRangeImpl"; +/** + * Represents a live range. + */ +export declare class RangeImpl extends AbstractRangeImpl implements Range { + static START_TO_START: number; + static START_TO_END: number; + static END_TO_END: number; + static END_TO_START: number; + START_TO_START: number; + START_TO_END: number; + END_TO_END: number; + END_TO_START: number; + _start: BoundaryPoint; + _end: BoundaryPoint; + /** + * Initializes a new instance of `Range`. + */ + constructor(); + /** @inheritdoc */ + get commonAncestorContainer(): Node; + /** @inheritdoc */ + setStart(node: Node, offset: number): void; + /** @inheritdoc */ + setEnd(node: Node, offset: number): void; + /** @inheritdoc */ + setStartBefore(node: Node): void; + /** @inheritdoc */ + setStartAfter(node: Node): void; + /** @inheritdoc */ + setEndBefore(node: Node): void; + /** @inheritdoc */ + setEndAfter(node: Node): void; + /** @inheritdoc */ + collapse(toStart?: boolean | undefined): void; + /** @inheritdoc */ + selectNode(node: Node): void; + /** @inheritdoc */ + selectNodeContents(node: Node): void; + /** @inheritdoc */ + compareBoundaryPoints(how: HowToCompare, sourceRange: Range): number; + /** @inheritdoc */ + deleteContents(): void; + /** @inheritdoc */ + extractContents(): DocumentFragment; + /** @inheritdoc */ + cloneContents(): DocumentFragment; + /** @inheritdoc */ + insertNode(node: Node): void; + /** @inheritdoc */ + surroundContents(newParent: Node): void; + /** @inheritdoc */ + cloneRange(): Range; + /** @inheritdoc */ + detach(): void; + /** @inheritdoc */ + isPointInRange(node: Node, offset: number): boolean; + /** @inheritdoc */ + comparePoint(node: Node, offset: number): number; + /** @inheritdoc */ + intersectsNode(node: Node): boolean; + toString(): string; + /** + * Creates a new `Range`. + * + * @param start - start point + * @param end - end point + */ + static _create(start?: BoundaryPoint, end?: BoundaryPoint): RangeImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/RangeImpl.js b/node_modules/@oozcitak/dom/lib/dom/RangeImpl.js new file mode 100644 index 0000000..a714493 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/RangeImpl.js @@ -0,0 +1,649 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var DOMImpl_1 = require("./DOMImpl"); +var interfaces_1 = require("./interfaces"); +var AbstractRangeImpl_1 = require("./AbstractRangeImpl"); +var DOMException_1 = require("./DOMException"); +var algorithm_1 = require("../algorithm"); +var WebIDLAlgorithm_1 = require("../algorithm/WebIDLAlgorithm"); +var util_1 = require("../util"); +/** + * Represents a live range. + */ +var RangeImpl = /** @class */ (function (_super) { + __extends(RangeImpl, _super); + /** + * Initializes a new instance of `Range`. + */ + function RangeImpl() { + var _this = _super.call(this) || this; + /** + * The Range() constructor, when invoked, must return a new live range with + * (current global object’s associated Document, 0) as its start and end. + */ + var doc = DOMImpl_1.dom.window._associatedDocument; + _this._start = [doc, 0]; + _this._end = [doc, 0]; + DOMImpl_1.dom.rangeList.add(_this); + return _this; + } + Object.defineProperty(RangeImpl.prototype, "commonAncestorContainer", { + /** @inheritdoc */ + get: function () { + /** + * 1. Let container be start node. + * 2. While container is not an inclusive ancestor of end node, let + * container be container’s parent. + * 3. Return container. + */ + var container = this._start[0]; + while (!algorithm_1.tree_isAncestorOf(this._end[0], container, true)) { + if (container._parent === null) { + throw new Error("Parent node is null."); + } + container = container._parent; + } + return container; + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + RangeImpl.prototype.setStart = function (node, offset) { + /** + * The setStart(node, offset) method, when invoked, must set the start of + * context object to boundary point (node, offset). + */ + algorithm_1.range_setTheStart(this, node, offset); + }; + /** @inheritdoc */ + RangeImpl.prototype.setEnd = function (node, offset) { + /** + * The setEnd(node, offset) method, when invoked, must set the end of + * context object to boundary point (node, offset). + */ + algorithm_1.range_setTheEnd(this, node, offset); + }; + /** @inheritdoc */ + RangeImpl.prototype.setStartBefore = function (node) { + /** + * 1. Let parent be node’s parent. + * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. + * 3. Set the start of the context object to boundary point + * (parent, node’s index). + */ + var parent = node._parent; + if (parent === null) + throw new DOMException_1.InvalidNodeTypeError(); + algorithm_1.range_setTheStart(this, parent, algorithm_1.tree_index(node)); + }; + /** @inheritdoc */ + RangeImpl.prototype.setStartAfter = function (node) { + /** + * 1. Let parent be node’s parent. + * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. + * 3. Set the start of the context object to boundary point + * (parent, node’s index plus 1). + */ + var parent = node._parent; + if (parent === null) + throw new DOMException_1.InvalidNodeTypeError(); + algorithm_1.range_setTheStart(this, parent, algorithm_1.tree_index(node) + 1); + }; + /** @inheritdoc */ + RangeImpl.prototype.setEndBefore = function (node) { + /** + * 1. Let parent be node’s parent. + * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. + * 3. Set the end of the context object to boundary point + * (parent, node’s index). + */ + var parent = node._parent; + if (parent === null) + throw new DOMException_1.InvalidNodeTypeError(); + algorithm_1.range_setTheEnd(this, parent, algorithm_1.tree_index(node)); + }; + /** @inheritdoc */ + RangeImpl.prototype.setEndAfter = function (node) { + /** + * 1. Let parent be node’s parent. + * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. + * 3. Set the end of the context object to boundary point + * (parent, node’s index plus 1). + */ + var parent = node._parent; + if (parent === null) + throw new DOMException_1.InvalidNodeTypeError(); + algorithm_1.range_setTheEnd(this, parent, algorithm_1.tree_index(node) + 1); + }; + /** @inheritdoc */ + RangeImpl.prototype.collapse = function (toStart) { + /** + * The collapse(toStart) method, when invoked, must if toStart is true, + * set end to start, and set start to end otherwise. + */ + if (toStart) { + this._end = this._start; + } + else { + this._start = this._end; + } + }; + /** @inheritdoc */ + RangeImpl.prototype.selectNode = function (node) { + /** + * The selectNode(node) method, when invoked, must select node within + * context object. + */ + algorithm_1.range_select(node, this); + }; + /** @inheritdoc */ + RangeImpl.prototype.selectNodeContents = function (node) { + /** + * 1. If node is a doctype, throw an "InvalidNodeTypeError" DOMException. + * 2. Let length be the length of node. + * 3. Set start to the boundary point (node, 0). + * 4. Set end to the boundary point (node, length). + */ + if (util_1.Guard.isDocumentTypeNode(node)) + throw new DOMException_1.InvalidNodeTypeError(); + var length = algorithm_1.tree_nodeLength(node); + this._start = [node, 0]; + this._end = [node, length]; + }; + /** @inheritdoc */ + RangeImpl.prototype.compareBoundaryPoints = function (how, sourceRange) { + /** + * 1. If how is not one of + * - START_TO_START, + * - START_TO_END, + * - END_TO_END, and + * - END_TO_START, + * then throw a "NotSupportedError" DOMException. + */ + if (how !== interfaces_1.HowToCompare.StartToStart && how !== interfaces_1.HowToCompare.StartToEnd && + how !== interfaces_1.HowToCompare.EndToEnd && how !== interfaces_1.HowToCompare.EndToStart) + throw new DOMException_1.NotSupportedError(); + /** + * 2. If context object’s root is not the same as sourceRange’s root, + * then throw a "WrongDocumentError" DOMException. + */ + if (algorithm_1.range_root(this) !== algorithm_1.range_root(sourceRange)) + throw new DOMException_1.WrongDocumentError(); + /** + * 3. If how is: + * - START_TO_START: + * Let this point be the context object’s start. Let other point be + * sourceRange’s start. + * - START_TO_END: + * Let this point be the context object’s end. Let other point be + * sourceRange’s start. + * - END_TO_END: + * Let this point be the context object’s end. Let other point be + * sourceRange’s end. + * - END_TO_START: + * Let this point be the context object’s start. Let other point be + * sourceRange’s end. + */ + var thisPoint; + var otherPoint; + switch (how) { + case interfaces_1.HowToCompare.StartToStart: + thisPoint = this._start; + otherPoint = sourceRange._start; + break; + case interfaces_1.HowToCompare.StartToEnd: + thisPoint = this._end; + otherPoint = sourceRange._start; + break; + case interfaces_1.HowToCompare.EndToEnd: + thisPoint = this._end; + otherPoint = sourceRange._end; + break; + case interfaces_1.HowToCompare.EndToStart: + thisPoint = this._start; + otherPoint = sourceRange._end; + break; + /* istanbul ignore next */ + default: + throw new DOMException_1.NotSupportedError(); + } + /** + * 4. If the position of this point relative to other point is + * - before + * Return −1. + * - equal + * Return 0. + * - after + * Return 1. + */ + var position = algorithm_1.boundaryPoint_position(thisPoint, otherPoint); + if (position === interfaces_1.BoundaryPosition.Before) { + return -1; + } + else if (position === interfaces_1.BoundaryPosition.After) { + return 1; + } + else { + return 0; + } + }; + /** @inheritdoc */ + RangeImpl.prototype.deleteContents = function () { + var e_1, _a, e_2, _b; + /** + * 1. If the context object is collapsed, then return. + * 2. Let original start node, original start offset, original end node, + * and original end offset be the context object’s start node, + * start offset, end node, and end offset, respectively. + */ + if (algorithm_1.range_collapsed(this)) + return; + var originalStartNode = this._startNode; + var originalStartOffset = this._startOffset; + var originalEndNode = this._endNode; + var originalEndOffset = this._endOffset; + /** + * 3. If original start node and original end node are the same, and they + * are a Text, ProcessingInstruction, or Comment node, replace data with + * node original start node, offset original start offset, count original + * end offset minus original start offset, and data the empty string, + * and then return. + */ + if (originalStartNode === originalEndNode && + util_1.Guard.isCharacterDataNode(originalStartNode)) { + algorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset, ''); + return; + } + /** + * 4. Let nodes to remove be a list of all the nodes that are contained in + * the context object, in tree order, omitting any node whose parent is also + * contained in the context object. + */ + var nodesToRemove = []; + try { + for (var _c = __values(algorithm_1.range_getContainedNodes(this)), _d = _c.next(); !_d.done; _d = _c.next()) { + var node = _d.value; + var parent = node._parent; + if (parent !== null && algorithm_1.range_isContained(parent, this)) { + continue; + } + nodesToRemove.push(node); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_d && !_d.done && (_a = _c.return)) _a.call(_c); + } + finally { if (e_1) throw e_1.error; } + } + var newNode; + var newOffset; + if (algorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) { + /** + * 5. If original start node is an inclusive ancestor of original end + * node, set new node to original start node and new offset to original + * start offset. + */ + newNode = originalStartNode; + newOffset = originalStartOffset; + } + else { + /** + * 6. Otherwise: + * 6.1. Let reference node equal original start node. + * 6.2. While reference node’s parent is not null and is not an inclusive + * ancestor of original end node, set reference node to its parent. + * 6.3. Set new node to the parent of reference node, and new offset to + * one plus the index of reference node. + */ + var referenceNode = originalStartNode; + while (referenceNode._parent !== null && + !algorithm_1.tree_isAncestorOf(originalEndNode, referenceNode._parent, true)) { + referenceNode = referenceNode._parent; + } + /* istanbul ignore next */ + if (referenceNode._parent === null) { + throw new Error("Parent node is null."); + } + newNode = referenceNode._parent; + newOffset = algorithm_1.tree_index(referenceNode) + 1; + } + /** + * 7. If original start node is a Text, ProcessingInstruction, or Comment + * node, replace data with node original start node, offset original start + * offset, count original start node’s length minus original start offset, + * data the empty string. + */ + if (util_1.Guard.isCharacterDataNode(originalStartNode)) { + algorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, algorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset, ''); + } + try { + /** + * 8. For each node in nodes to remove, in tree order, remove node from its + * parent. + */ + for (var nodesToRemove_1 = __values(nodesToRemove), nodesToRemove_1_1 = nodesToRemove_1.next(); !nodesToRemove_1_1.done; nodesToRemove_1_1 = nodesToRemove_1.next()) { + var node = nodesToRemove_1_1.value; + /* istanbul ignore else */ + if (node._parent) { + algorithm_1.mutation_remove(node, node._parent); + } + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (nodesToRemove_1_1 && !nodesToRemove_1_1.done && (_b = nodesToRemove_1.return)) _b.call(nodesToRemove_1); + } + finally { if (e_2) throw e_2.error; } + } + /** + * 9. If original end node is a Text, ProcessingInstruction, or Comment + * node, replace data with node original end node, offset 0, count original + * end offset and data the empty string. + */ + if (util_1.Guard.isCharacterDataNode(originalEndNode)) { + algorithm_1.characterData_replaceData(originalEndNode, 0, originalEndOffset, ''); + } + /** + * 10. Set start and end to (new node, new offset). + */ + this._start = [newNode, newOffset]; + this._end = [newNode, newOffset]; + }; + /** @inheritdoc */ + RangeImpl.prototype.extractContents = function () { + /** + * The extractContents() method, when invoked, must return the result of + * extracting the context object. + */ + return algorithm_1.range_extract(this); + }; + /** @inheritdoc */ + RangeImpl.prototype.cloneContents = function () { + /** + * The cloneContents() method, when invoked, must return the result of + * cloning the contents of the context object. + */ + return algorithm_1.range_cloneTheContents(this); + }; + /** @inheritdoc */ + RangeImpl.prototype.insertNode = function (node) { + /** + * The insertNode(node) method, when invoked, must insert node into the + * context object. + */ + return algorithm_1.range_insert(node, this); + }; + /** @inheritdoc */ + RangeImpl.prototype.surroundContents = function (newParent) { + var e_3, _a; + try { + /** + * 1. If a non-Text node is partially contained in the context object, then + * throw an "InvalidStateError" DOMException. + */ + for (var _b = __values(algorithm_1.range_getPartiallyContainedNodes(this)), _c = _b.next(); !_c.done; _c = _b.next()) { + var node = _c.value; + if (!util_1.Guard.isTextNode(node)) { + throw new DOMException_1.InvalidStateError(); + } + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_3) throw e_3.error; } + } + /** + * 2. If newParent is a Document, DocumentType, or DocumentFragment node, + * then throw an "InvalidNodeTypeError" DOMException. + */ + if (util_1.Guard.isDocumentNode(newParent) || + util_1.Guard.isDocumentTypeNode(newParent) || + util_1.Guard.isDocumentFragmentNode(newParent)) { + throw new DOMException_1.InvalidNodeTypeError(); + } + /** + * 3. Let fragment be the result of extracting the context object. + */ + var fragment = algorithm_1.range_extract(this); + /** + * 4. If newParent has children, then replace all with null within newParent. + */ + if ((newParent)._children.size !== 0) { + algorithm_1.mutation_replaceAll(null, newParent); + } + /** + * 5. Insert newParent into the context object. + * 6. Append fragment to newParent. + */ + algorithm_1.range_insert(newParent, this); + algorithm_1.mutation_append(fragment, newParent); + /** + * 7. Select newParent within the context object. + */ + algorithm_1.range_select(newParent, this); + }; + /** @inheritdoc */ + RangeImpl.prototype.cloneRange = function () { + /** + * The cloneRange() method, when invoked, must return a new live range with + * the same start and end as the context object. + */ + return algorithm_1.create_range(this._start, this._end); + }; + /** @inheritdoc */ + RangeImpl.prototype.detach = function () { + /** + * The detach() method, when invoked, must do nothing. + * + * since JS lacks weak references, we still use detach + */ + DOMImpl_1.dom.rangeList.delete(this); + }; + /** @inheritdoc */ + RangeImpl.prototype.isPointInRange = function (node, offset) { + /** + * 1. If node’s root is different from the context object’s root, return false. + */ + if (algorithm_1.tree_rootNode(node) !== algorithm_1.range_root(this)) { + return false; + } + /** + * 2. If node is a doctype, then throw an "InvalidNodeTypeError" DOMException. + * 3. If offset is greater than node’s length, then throw an + * "IndexSizeError" DOMException. + */ + if (util_1.Guard.isDocumentTypeNode(node)) + throw new DOMException_1.InvalidNodeTypeError(); + if (offset > algorithm_1.tree_nodeLength(node)) + throw new DOMException_1.IndexSizeError(); + /** + * 4. If (node, offset) is before start or after end, return false. + */ + var bp = [node, offset]; + if (algorithm_1.boundaryPoint_position(bp, this._start) === interfaces_1.BoundaryPosition.Before || + algorithm_1.boundaryPoint_position(bp, this._end) === interfaces_1.BoundaryPosition.After) { + return false; + } + /** + * 5. Return true. + */ + return true; + }; + /** @inheritdoc */ + RangeImpl.prototype.comparePoint = function (node, offset) { + /** + * 1. If node’s root is different from the context object’s root, then throw + * a "WrongDocumentError" DOMException. + * 2. If node is a doctype, then throw an "InvalidNodeTypeError" DOMException. + * 3. If offset is greater than node’s length, then throw an + * "IndexSizeError" DOMException. + */ + if (algorithm_1.tree_rootNode(node) !== algorithm_1.range_root(this)) + throw new DOMException_1.WrongDocumentError(); + if (util_1.Guard.isDocumentTypeNode(node)) + throw new DOMException_1.InvalidNodeTypeError(); + if (offset > algorithm_1.tree_nodeLength(node)) + throw new DOMException_1.IndexSizeError(); + /** + * 4. If (node, offset) is before start, return −1. + * 5. If (node, offset) is after end, return 1. + * 6. Return 0. + */ + var bp = [node, offset]; + if (algorithm_1.boundaryPoint_position(bp, this._start) === interfaces_1.BoundaryPosition.Before) { + return -1; + } + else if (algorithm_1.boundaryPoint_position(bp, this._end) === interfaces_1.BoundaryPosition.After) { + return 1; + } + else { + return 0; + } + }; + /** @inheritdoc */ + RangeImpl.prototype.intersectsNode = function (node) { + /** + * 1. If node’s root is different from the context object’s root, return false. + */ + if (algorithm_1.tree_rootNode(node) !== algorithm_1.range_root(this)) { + return false; + } + /** + * 2. Let parent be node’s parent. + * 3. If parent is null, return true. + */ + var parent = node._parent; + if (parent === null) + return true; + /** + * 4. Let offset be node’s index. + */ + var offset = algorithm_1.tree_index(node); + /** + * 5. If (parent, offset) is before end and (parent, offset plus 1) is + * after start, return true. + */ + if (algorithm_1.boundaryPoint_position([parent, offset], this._end) === interfaces_1.BoundaryPosition.Before && + algorithm_1.boundaryPoint_position([parent, offset + 1], this._start) === interfaces_1.BoundaryPosition.After) { + return true; + } + /** + * 6. Return false. + */ + return false; + }; + RangeImpl.prototype.toString = function () { + var e_4, _a; + /** + * 1. Let s be the empty string. + */ + var s = ''; + /** + * 2. If the context object’s start node is the context object’s end node + * and it is a Text node, then return the substring of that Text node’s data + * beginning at the context object’s start offset and ending at the context + * object’s end offset. + */ + if (this._startNode === this._endNode && util_1.Guard.isTextNode(this._startNode)) { + return this._startNode._data.substring(this._startOffset, this._endOffset); + } + /** + * 3. If the context object’s start node is a Text node, then append the + * substring of that node’s data from the context object’s start offset + * until the end to s. + */ + if (util_1.Guard.isTextNode(this._startNode)) { + s += this._startNode._data.substring(this._startOffset); + } + try { + /** + * 4. Append the concatenation of the data of all Text nodes that are + * contained in the context object, in tree order, to s. + */ + for (var _b = __values(algorithm_1.range_getContainedNodes(this)), _c = _b.next(); !_c.done; _c = _b.next()) { + var child = _c.value; + if (util_1.Guard.isTextNode(child)) { + s += child._data; + } + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_4) throw e_4.error; } + } + /** + * 5. If the context object’s end node is a Text node, then append the + * substring of that node’s data from its start until the context object’s + * end offset to s. + */ + if (util_1.Guard.isTextNode(this._endNode)) { + s += this._endNode._data.substring(0, this._endOffset); + } + /** + * 6. Return s. + */ + return s; + }; + /** + * Creates a new `Range`. + * + * @param start - start point + * @param end - end point + */ + RangeImpl._create = function (start, end) { + var range = new RangeImpl(); + if (start) + range._start = start; + if (end) + range._end = end; + return range; + }; + RangeImpl.START_TO_START = 0; + RangeImpl.START_TO_END = 1; + RangeImpl.END_TO_END = 2; + RangeImpl.END_TO_START = 3; + return RangeImpl; +}(AbstractRangeImpl_1.AbstractRangeImpl)); +exports.RangeImpl = RangeImpl; +/** + * Define constants on prototype. + */ +WebIDLAlgorithm_1.idl_defineConst(RangeImpl.prototype, "START_TO_START", 0); +WebIDLAlgorithm_1.idl_defineConst(RangeImpl.prototype, "START_TO_END", 1); +WebIDLAlgorithm_1.idl_defineConst(RangeImpl.prototype, "END_TO_END", 2); +WebIDLAlgorithm_1.idl_defineConst(RangeImpl.prototype, "END_TO_START", 3); +//# sourceMappingURL=RangeImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/RangeImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/RangeImpl.js.map new file mode 100644 index 0000000..69d3e8e --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/RangeImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RangeImpl.js","sourceRoot":"","sources":["../../src/dom/RangeImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAA+B;AAC/B,2CAGqB;AACrB,yDAAuD;AACvD,+CAGuB;AACvB,0CAOqB;AACrB,gEAA8D;AAC9D,gCAA+B;AAE/B;;GAEG;AACH;IAA+B,6BAAiB;IAe9C;;OAEG;IACH;QAAA,YACE,iBAAO,SAWR;QATC;;;WAGG;QACH,IAAM,GAAG,GAAG,aAAG,CAAC,MAAM,CAAC,mBAAmB,CAAA;QAC1C,KAAI,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QACtB,KAAI,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QAEpB,aAAG,CAAC,SAAS,CAAC,GAAG,CAAC,KAAI,CAAC,CAAA;;IACzB,CAAC;IAGD,sBAAI,8CAAuB;QAD3B,kBAAkB;aAClB;YACE;;;;;eAKG;YACH,IAAI,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;YAC9B,OAAO,CAAC,6BAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE;gBACxD,IAAI,SAAS,CAAC,OAAO,KAAK,IAAI,EAAE;oBAC9B,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;iBACzC;gBACD,SAAS,GAAG,SAAS,CAAC,OAAO,CAAA;aAC9B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CAAC,CAAA;AACrD,iCAAe,CAAC,SAAS,CAAC,SAAS,EAAE,cAAc,EAAE,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/ShadowRootImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/ShadowRootImpl.d.ts new file mode 100644 index 0000000..feb5934 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/ShadowRootImpl.d.ts @@ -0,0 +1,33 @@ +import { Element, ShadowRootMode, Event, EventTarget, ShadowRoot, Document } from "./interfaces"; +import { DocumentFragmentImpl } from "./DocumentFragmentImpl"; +/** + * Represents a shadow root. + */ +export declare class ShadowRootImpl extends DocumentFragmentImpl implements ShadowRoot { + _host: Element; + _mode: ShadowRootMode; + /** + * Initializes a new instance of `ShadowRoot`. + * + * @param host - shadow root's host element + * @param mode - shadow root's mode + */ + private constructor(); + /** @inheritdoc */ + get mode(): ShadowRootMode; + /** @inheritdoc */ + get host(): Element; + /** + * Gets the parent event target for the given event. + * + * @param event - an event + */ + _getTheParent(event: Event): EventTarget | null; + /** + * Creates a new `ShadowRoot`. + * + * @param document - owner document + * @param host - shadow root's host element + */ + static _create(document: Document, host: Element): ShadowRootImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/ShadowRootImpl.js b/node_modules/@oozcitak/dom/lib/dom/ShadowRootImpl.js new file mode 100644 index 0000000..a00163e --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/ShadowRootImpl.js @@ -0,0 +1,82 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var DocumentFragmentImpl_1 = require("./DocumentFragmentImpl"); +var util_1 = require("@oozcitak/util"); +var algorithm_1 = require("../algorithm"); +/** + * Represents a shadow root. + */ +var ShadowRootImpl = /** @class */ (function (_super) { + __extends(ShadowRootImpl, _super); + /** + * Initializes a new instance of `ShadowRoot`. + * + * @param host - shadow root's host element + * @param mode - shadow root's mode + */ + function ShadowRootImpl(host, mode) { + var _this = _super.call(this) || this; + _this._host = host; + _this._mode = mode; + return _this; + } + Object.defineProperty(ShadowRootImpl.prototype, "mode", { + /** @inheritdoc */ + get: function () { return this._mode; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ShadowRootImpl.prototype, "host", { + /** @inheritdoc */ + get: function () { return this._host; }, + enumerable: true, + configurable: true + }); + /** + * Gets the parent event target for the given event. + * + * @param event - an event + */ + ShadowRootImpl.prototype._getTheParent = function (event) { + /** + * A shadow root’s get the parent algorithm, given an event, returns null + * if event’s composed flag is unset and shadow root is the root of + * event’s path’s first struct’s invocation target, and shadow root’s host + * otherwise. + */ + if (!event._composedFlag && !util_1.isEmpty(event._path) && + algorithm_1.tree_rootNode(event._path[0].invocationTarget) === this) { + return null; + } + else { + return this._host; + } + }; + // MIXIN: DocumentOrShadowRoot + // No elements + /** + * Creates a new `ShadowRoot`. + * + * @param document - owner document + * @param host - shadow root's host element + */ + ShadowRootImpl._create = function (document, host) { + return new ShadowRootImpl(host, "closed"); + }; + return ShadowRootImpl; +}(DocumentFragmentImpl_1.DocumentFragmentImpl)); +exports.ShadowRootImpl = ShadowRootImpl; +//# sourceMappingURL=ShadowRootImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/ShadowRootImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/ShadowRootImpl.js.map new file mode 100644 index 0000000..bc83c91 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/ShadowRootImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ShadowRootImpl.js","sourceRoot":"","sources":["../../src/dom/ShadowRootImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,+DAA6D;AAC7D,uCAAwC;AACxC,0CAA4C;AAE5C;;GAEG;AACH;IAAoC,kCAAoB;IAKtD;;;;;OAKG;IACH,wBAAoB,IAAa,EAAE,IAAoB;QAAvD,YACE,iBAAO,SAIR;QAFC,KAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,KAAI,CAAC,KAAK,GAAG,IAAI,CAAA;;IACnB,CAAC;IAGD,sBAAI,gCAAI;QADR,kBAAkB;aAClB,cAA6B,OAAO,IAAI,CAAC,KAAK,CAAA,CAAC,CAAC;;;OAAA;IAGhD,sBAAI,gCAAI;QADR,kBAAkB;aAClB,cAAsB,OAAO,IAAI,CAAC,KAAK,CAAA,CAAC,CAAC;;;OAAA;IAEzC;;;;OAIG;IACH,sCAAa,GAAb,UAAc,KAAY;QACxB;;;;;WAKG;QACH,IAAI,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,cAAO,CAAC,KAAK,CAAC,KAAK,CAAC;YAC/C,yBAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,gBAAwB,CAAC,KAAK,IAAI,EAAE;YACjE,OAAO,IAAI,CAAA;SACZ;aAAM;YACL,OAAO,IAAI,CAAC,KAAK,CAAA;SAClB;IACH,CAAC;IAED,8BAA8B;IAC9B,cAAc;IAEd;;;;;OAKG;IACI,sBAAO,GAAd,UAAe,QAAkB,EAAE,IAAa;QAC9C,OAAO,IAAI,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAC3C,CAAC;IACH,qBAAC;AAAD,CAAC,AAxDD,CAAoC,2CAAoB,GAwDvD;AAxDY,wCAAc"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/SlotableImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/SlotableImpl.d.ts new file mode 100644 index 0000000..08fbfd6 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/SlotableImpl.d.ts @@ -0,0 +1,16 @@ +import { Slotable, Slot, HTMLSlotElement } from "./interfaces"; +/** + * Represents a mixin that allows nodes to become the contents of + * a element. This mixin is implemented by {@link Element} and + * {@link Text}. + */ +export declare class SlotableImpl implements Slotable { + __name: string | undefined; + __assignedSlot: Slot | null | undefined; + get _name(): string; + set _name(val: string); + get _assignedSlot(): Slot | null; + set _assignedSlot(val: Slot | null); + /** @inheritdoc */ + get assignedSlot(): HTMLSlotElement | null; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/SlotableImpl.js b/node_modules/@oozcitak/dom/lib/dom/SlotableImpl.js new file mode 100644 index 0000000..739dabe --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/SlotableImpl.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var algorithm_1 = require("../algorithm"); +/** + * Represents a mixin that allows nodes to become the contents of + * a element. This mixin is implemented by {@link Element} and + * {@link Text}. + */ +var SlotableImpl = /** @class */ (function () { + function SlotableImpl() { + } + Object.defineProperty(SlotableImpl.prototype, "_name", { + get: function () { return this.__name || ''; }, + set: function (val) { this.__name = val; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SlotableImpl.prototype, "_assignedSlot", { + get: function () { return this.__assignedSlot || null; }, + set: function (val) { this.__assignedSlot = val; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SlotableImpl.prototype, "assignedSlot", { + /** @inheritdoc */ + get: function () { + return algorithm_1.shadowTree_findASlot(this, true); + }, + enumerable: true, + configurable: true + }); + return SlotableImpl; +}()); +exports.SlotableImpl = SlotableImpl; +//# sourceMappingURL=SlotableImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/SlotableImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/SlotableImpl.js.map new file mode 100644 index 0000000..679e2b7 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/SlotableImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"SlotableImpl.js","sourceRoot":"","sources":["../../src/dom/SlotableImpl.ts"],"names":[],"mappings":";;AACA,0CAAmD;AAEnD;;;;GAIG;AACH;IAAA;IAgBA,CAAC;IAXC,sBAAI,+BAAK;aAAT,cAAsB,OAAO,IAAI,CAAC,MAAM,IAAI,EAAE,CAAA,CAAC,CAAC;aAChD,UAAU,GAAW,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,CAAA,CAAC,CAAC;;;OADI;IAGhD,sBAAI,uCAAa;aAAjB,cAAmC,OAAO,IAAI,CAAC,cAAc,IAAI,IAAI,CAAA,CAAC,CAAC;aACvE,UAAkB,GAAgB,IAAI,IAAI,CAAC,cAAc,GAAG,GAAG,CAAA,CAAC,CAAC;;;OADM;IAIvE,sBAAI,sCAAY;QADhB,kBAAkB;aAClB;YACE,OAAO,gCAAoB,CAAC,IAAI,EAAE,IAAI,CAA2B,CAAA;QACnE,CAAC;;;OAAA;IAEH,mBAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,oCAAY"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/StaticRangeImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/StaticRangeImpl.d.ts new file mode 100644 index 0000000..c8de51b --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/StaticRangeImpl.d.ts @@ -0,0 +1,13 @@ +import { AbstractRangeImpl } from "./AbstractRangeImpl"; +import { BoundaryPoint, StaticRangeInit, StaticRange } from "./interfaces"; +/** + * Represents a static range. + */ +export declare class StaticRangeImpl extends AbstractRangeImpl implements StaticRange { + _start: BoundaryPoint; + _end: BoundaryPoint; + /** + * Initializes a new instance of `StaticRange`. + */ + constructor(init: StaticRangeInit); +} diff --git a/node_modules/@oozcitak/dom/lib/dom/StaticRangeImpl.js b/node_modules/@oozcitak/dom/lib/dom/StaticRangeImpl.js new file mode 100644 index 0000000..ff6162d --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/StaticRangeImpl.js @@ -0,0 +1,48 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var AbstractRangeImpl_1 = require("./AbstractRangeImpl"); +var DOMException_1 = require("./DOMException"); +var util_1 = require("../util"); +/** + * Represents a static range. + */ +var StaticRangeImpl = /** @class */ (function (_super) { + __extends(StaticRangeImpl, _super); + /** + * Initializes a new instance of `StaticRange`. + */ + function StaticRangeImpl(init) { + var _this = _super.call(this) || this; + /** + * 1. If init’s startContainer or endContainer is a DocumentType or Attr + * node, then throw an "InvalidNodeTypeError" DOMException. + * 2. Let staticRange be a new StaticRange object. + * 3. Set staticRange’s start to (init’s startContainer, init’s startOffset) + * and end to (init’s endContainer, init’s endOffset). + * 4. Return staticRange. + */ + if (util_1.Guard.isDocumentTypeNode(init.startContainer) || util_1.Guard.isAttrNode(init.startContainer) || + util_1.Guard.isDocumentTypeNode(init.endContainer) || util_1.Guard.isAttrNode(init.endContainer)) { + throw new DOMException_1.InvalidNodeTypeError(); + } + _this._start = [init.startContainer, init.startOffset]; + _this._end = [init.endContainer, init.endOffset]; + return _this; + } + return StaticRangeImpl; +}(AbstractRangeImpl_1.AbstractRangeImpl)); +exports.StaticRangeImpl = StaticRangeImpl; +//# sourceMappingURL=StaticRangeImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/StaticRangeImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/StaticRangeImpl.js.map new file mode 100644 index 0000000..699cd3a --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/StaticRangeImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"StaticRangeImpl.js","sourceRoot":"","sources":["../../src/dom/StaticRangeImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yDAAuD;AACvD,+CAAqD;AAErD,gCAA+B;AAE/B;;GAEG;AACH;IAAqC,mCAAiB;IAKpD;;OAEG;IACH,yBAAY,IAAqB;QAAjC,YACE,iBAAO,SAeR;QAdC;;;;;;;WAOG;QACH,IAAI,YAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,YAAK,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC;YACxF,YAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,YAAK,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE;YACpF,MAAM,IAAI,mCAAoB,EAAE,CAAA;SACjC;QACD,KAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;QACrD,KAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;;IACjD,CAAC;IAEH,sBAAC;AAAD,CAAC,AA1BD,CAAqC,qCAAiB,GA0BrD;AA1BY,0CAAe"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/TextImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/TextImpl.d.ts new file mode 100644 index 0000000..925ee1a --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/TextImpl.d.ts @@ -0,0 +1,28 @@ +import { NodeType, Text, HTMLSlotElement, Document, Slot } from "./interfaces"; +import { CharacterDataImpl } from "./CharacterDataImpl"; +/** + * Represents a text node. + */ +export declare class TextImpl extends CharacterDataImpl implements Text { + _nodeType: NodeType; + _name: string; + _assignedSlot: Slot | null; + /** + * Initializes a new instance of `Text`. + * + * @param data - the text content + */ + constructor(data?: string); + /** @inheritdoc */ + get wholeText(): string; + /** @inheritdoc */ + splitText(offset: number): Text; + get assignedSlot(): HTMLSlotElement | null; + /** + * Creates a `Text`. + * + * @param document - owner document + * @param data - the text content + */ + static _create(document: Document, data?: string): TextImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/TextImpl.js b/node_modules/@oozcitak/dom/lib/dom/TextImpl.js new file mode 100644 index 0000000..134b2d6 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/TextImpl.js @@ -0,0 +1,109 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("./interfaces"); +var CharacterDataImpl_1 = require("./CharacterDataImpl"); +var algorithm_1 = require("../algorithm"); +var WebIDLAlgorithm_1 = require("../algorithm/WebIDLAlgorithm"); +/** + * Represents a text node. + */ +var TextImpl = /** @class */ (function (_super) { + __extends(TextImpl, _super); + /** + * Initializes a new instance of `Text`. + * + * @param data - the text content + */ + function TextImpl(data) { + if (data === void 0) { data = ''; } + var _this = _super.call(this, data) || this; + _this._name = ''; + _this._assignedSlot = null; + return _this; + } + Object.defineProperty(TextImpl.prototype, "wholeText", { + /** @inheritdoc */ + get: function () { + var e_1, _a; + /** + * The wholeText attribute’s getter must return the concatenation of the + * data of the contiguous Text nodes of the context object, in tree order. + */ + var text = ''; + try { + for (var _b = __values(algorithm_1.text_contiguousTextNodes(this, true)), _c = _b.next(); !_c.done; _c = _b.next()) { + var node = _c.value; + text = text + node._data; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + return text; + }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + TextImpl.prototype.splitText = function (offset) { + /** + * The splitText(offset) method, when invoked, must split context object + * with offset offset. + */ + return algorithm_1.text_split(this, offset); + }; + Object.defineProperty(TextImpl.prototype, "assignedSlot", { + // MIXIN: Slotable + /* istanbul ignore next */ + get: function () { throw new Error("Mixin: Slotable not implemented."); }, + enumerable: true, + configurable: true + }); + /** + * Creates a `Text`. + * + * @param document - owner document + * @param data - the text content + */ + TextImpl._create = function (document, data) { + if (data === void 0) { data = ''; } + var node = new TextImpl(data); + node._nodeDocument = document; + return node; + }; + return TextImpl; +}(CharacterDataImpl_1.CharacterDataImpl)); +exports.TextImpl = TextImpl; +/** + * Initialize prototype properties + */ +WebIDLAlgorithm_1.idl_defineConst(TextImpl.prototype, "_nodeType", interfaces_1.NodeType.Text); +//# sourceMappingURL=TextImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/TextImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/TextImpl.js.map new file mode 100644 index 0000000..c899de1 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/TextImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextImpl.js","sourceRoot":"","sources":["../../src/dom/TextImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA8E;AAC9E,yDAAuD;AACvD,0CAAmE;AACnE,gEAA8D;AAE9D;;GAEG;AACH;IAA8B,4BAAiB;IAO7C;;;;OAIG;IACH,kBAAmB,IAAiB;QAAjB,qBAAA,EAAA,SAAiB;QAApC,YACE,kBAAM,IAAI,CAAC,SACZ;QAVD,WAAK,GAAW,EAAE,CAAA;QAClB,mBAAa,GAAgB,IAAI,CAAA;;IASjC,CAAC;IAGD,sBAAI,+BAAS;QADb,kBAAkB;aAClB;;YACE;;;eAGG;YACH,IAAI,IAAI,GAAG,EAAE,CAAA;;gBAEb,KAAmB,IAAA,KAAA,SAAA,oCAAwB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA,gBAAA,4BAAE;oBAApD,IAAM,IAAI,WAAA;oBACb,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,CAAA;iBACzB;;;;;;;;;YAED,OAAO,IAAI,CAAA;QACb,CAAC;;;OAAA;IAED,kBAAkB;IAClB,4BAAS,GAAT,UAAU,MAAc;QACtB;;;WAGG;QACH,OAAO,sBAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IACjC,CAAC;IAID,sBAAI,kCAAY;QAFhB,kBAAkB;QAClB,0BAA0B;aAC1B,cAA6C,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAA,CAAC,CAAC;;;OAAA;IAElG;;;;;OAKG;IACI,gBAAO,GAAd,UAAe,QAAkB,EAAE,IAAiB;QAAjB,qBAAA,EAAA,SAAiB;QAClD,IAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAA;QAC/B,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAA;QAC7B,OAAO,IAAI,CAAA;IACb,CAAC;IAEH,eAAC;AAAD,CAAC,AAxDD,CAA8B,qCAAiB,GAwD9C;AAxDY,4BAAQ;AA0DrB;;GAEG;AACH,iCAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,WAAW,EAAE,qBAAQ,CAAC,IAAI,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/TraverserImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/TraverserImpl.d.ts new file mode 100644 index 0000000..255a5e8 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/TraverserImpl.d.ts @@ -0,0 +1,23 @@ +import { Node, NodeFilter, WhatToShow, Traverser } from "./interfaces"; +/** + * Represents an object which can be used to iterate through the nodes + * of a subtree. + */ +export declare abstract class TraverserImpl implements Traverser { + _activeFlag: boolean; + _root: Node; + _whatToShow: WhatToShow; + _filter: NodeFilter | null; + /** + * Initializes a new instance of `Traverser`. + * + * @param root - root node + */ + protected constructor(root: Node); + /** @inheritdoc */ + get root(): Node; + /** @inheritdoc */ + get whatToShow(): WhatToShow; + /** @inheritdoc */ + get filter(): NodeFilter | null; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/TraverserImpl.js b/node_modules/@oozcitak/dom/lib/dom/TraverserImpl.js new file mode 100644 index 0000000..5241cbd --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/TraverserImpl.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("./interfaces"); +/** + * Represents an object which can be used to iterate through the nodes + * of a subtree. + */ +var TraverserImpl = /** @class */ (function () { + /** + * Initializes a new instance of `Traverser`. + * + * @param root - root node + */ + function TraverserImpl(root) { + this._activeFlag = false; + this._root = root; + this._whatToShow = interfaces_1.WhatToShow.All; + this._filter = null; + } + Object.defineProperty(TraverserImpl.prototype, "root", { + /** @inheritdoc */ + get: function () { return this._root; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(TraverserImpl.prototype, "whatToShow", { + /** @inheritdoc */ + get: function () { return this._whatToShow; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(TraverserImpl.prototype, "filter", { + /** @inheritdoc */ + get: function () { return this._filter; }, + enumerable: true, + configurable: true + }); + return TraverserImpl; +}()); +exports.TraverserImpl = TraverserImpl; +//# sourceMappingURL=TraverserImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/TraverserImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/TraverserImpl.js.map new file mode 100644 index 0000000..91352ec --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/TraverserImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TraverserImpl.js","sourceRoot":"","sources":["../../src/dom/TraverserImpl.ts"],"names":[],"mappings":";;AAAA,2CAAsE;AAEtE;;;GAGG;AACH;IAOE;;;;OAIG;IACH,uBAAsB,IAAU;QAC9B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAA;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,WAAW,GAAG,uBAAU,CAAC,GAAG,CAAA;QACjC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;IACrB,CAAC;IAGD,sBAAI,+BAAI;QADR,kBAAkB;aAClB,cAAmB,OAAO,IAAI,CAAC,KAAK,CAAA,CAAC,CAAC;;;OAAA;IAGtC,sBAAI,qCAAU;QADd,kBAAkB;aAClB,cAA+B,OAAO,IAAI,CAAC,WAAW,CAAA,CAAC,CAAC;;;OAAA;IAGxD,sBAAI,iCAAM;QADV,kBAAkB;aAClB,cAAkC,OAAO,IAAI,CAAC,OAAO,CAAA,CAAC,CAAC;;;OAAA;IAEzD,oBAAC;AAAD,CAAC,AA5BD,IA4BC;AA5BqB,sCAAa"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/TreeWalkerImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/TreeWalkerImpl.d.ts new file mode 100644 index 0000000..1b9fc32 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/TreeWalkerImpl.d.ts @@ -0,0 +1,36 @@ +import { Node, TreeWalker } from "./interfaces"; +import { TraverserImpl } from "./TraverserImpl"; +/** + * Represents the nodes of a subtree and a position within them. + */ +export declare class TreeWalkerImpl extends TraverserImpl implements TreeWalker { + _current: Node; + /** + * Initializes a new instance of `TreeWalker`. + */ + private constructor(); + /** @inheritdoc */ + get currentNode(): Node; + set currentNode(value: Node); + /** @inheritdoc */ + parentNode(): Node | null; + /** @inheritdoc */ + firstChild(): Node | null; + /** @inheritdoc */ + lastChild(): Node | null; + /** @inheritdoc */ + nextSibling(): Node | null; + /** @inheritdoc */ + previousNode(): Node | null; + /** @inheritdoc */ + previousSibling(): Node | null; + /** @inheritdoc */ + nextNode(): Node | null; + /** + * Creates a new `TreeWalker`. + * + * @param root - iterator's root node + * @param current - current node + */ + static _create(root: Node, current: Node): TreeWalkerImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/TreeWalkerImpl.js b/node_modules/@oozcitak/dom/lib/dom/TreeWalkerImpl.js new file mode 100644 index 0000000..8bed3c9 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/TreeWalkerImpl.js @@ -0,0 +1,249 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("./interfaces"); +var TraverserImpl_1 = require("./TraverserImpl"); +var algorithm_1 = require("../algorithm"); +/** + * Represents the nodes of a subtree and a position within them. + */ +var TreeWalkerImpl = /** @class */ (function (_super) { + __extends(TreeWalkerImpl, _super); + /** + * Initializes a new instance of `TreeWalker`. + */ + function TreeWalkerImpl(root, current) { + var _this = _super.call(this, root) || this; + _this._current = current; + return _this; + } + Object.defineProperty(TreeWalkerImpl.prototype, "currentNode", { + /** @inheritdoc */ + get: function () { return this._current; }, + set: function (value) { this._current = value; }, + enumerable: true, + configurable: true + }); + /** @inheritdoc */ + TreeWalkerImpl.prototype.parentNode = function () { + /** + * 1. Let node be the context object’s current. + * 2. While node is non-null and is not the context object’s root: + */ + var node = this._current; + while (node !== null && node !== this._root) { + /** + * 2.1. Set node to node’s parent. + * 2.2. If node is non-null and filtering node within the context object + * returns FILTER_ACCEPT, then set the context object’s current to node + * and return node. + */ + node = node._parent; + if (node !== null && + algorithm_1.traversal_filter(this, node) === interfaces_1.FilterResult.Accept) { + this._current = node; + return node; + } + } + /** + * 3. Return null. + */ + return null; + }; + /** @inheritdoc */ + TreeWalkerImpl.prototype.firstChild = function () { + /** + * The firstChild() method, when invoked, must traverse children with the + * context object and first. + */ + return algorithm_1.treeWalker_traverseChildren(this, true); + }; + /** @inheritdoc */ + TreeWalkerImpl.prototype.lastChild = function () { + /** + * The lastChild() method, when invoked, must traverse children with the + * context object and last. + */ + return algorithm_1.treeWalker_traverseChildren(this, false); + }; + /** @inheritdoc */ + TreeWalkerImpl.prototype.nextSibling = function () { + /** + * The nextSibling() method, when invoked, must traverse siblings with the + * context object and next. + */ + return algorithm_1.treeWalker_traverseSiblings(this, true); + }; + /** @inheritdoc */ + TreeWalkerImpl.prototype.previousNode = function () { + /** + * 1. Let node be the context object’s current. + * 2. While node is not the context object’s root: + */ + var node = this._current; + while (node !== this._root) { + /** + * 2.1. Let sibling be node’s previous sibling. + * 2.2. While sibling is non-null: + */ + var sibling = node._previousSibling; + while (sibling) { + /** + * 2.2.1. Set node to sibling. + * 2.2.2. Let result be the result of filtering node within the context + * object. + */ + node = sibling; + var result = algorithm_1.traversal_filter(this, node); + /** + * 2.2.3. While result is not FILTER_REJECT and node has a child: + */ + while (result !== interfaces_1.FilterResult.Reject && node._lastChild) { + /** + * 2.2.3.1. Set node to node’s last child. + * 2.2.3.2. Set result to the result of filtering node within the + * context object. + */ + node = node._lastChild; + result = algorithm_1.traversal_filter(this, node); + } + /** + * 2.2.4. If result is FILTER_ACCEPT, then set the context object’s + * current to node and return node. + */ + if (result === interfaces_1.FilterResult.Accept) { + this._current = node; + return node; + } + /** + * 2.2.5. Set sibling to node’s previous sibling. + */ + sibling = node._previousSibling; + } + /** + * 2.3. If node is the context object’s root or node’s parent is null, + * then return null. + */ + if (node === this._root || node._parent === null) { + return null; + } + /** + * 2.4. Set node to node’s parent. + */ + node = node._parent; + /** + * 2.5. If the return value of filtering node within the context object is + * FILTER_ACCEPT, then set the context object’s current to node and + * return node. + */ + if (algorithm_1.traversal_filter(this, node) === interfaces_1.FilterResult.Accept) { + this._current = node; + return node; + } + } + /** + * 3. Return null. + */ + return null; + }; + /** @inheritdoc */ + TreeWalkerImpl.prototype.previousSibling = function () { + /** + * The previousSibling() method, when invoked, must traverse siblings with + * the context object and previous. + */ + return algorithm_1.treeWalker_traverseSiblings(this, false); + }; + /** @inheritdoc */ + TreeWalkerImpl.prototype.nextNode = function () { + /** + * 1. Let node be the context object’s current. + * 2. Let result be FILTER_ACCEPT. + * 3. While true: + */ + var node = this._current; + var result = interfaces_1.FilterResult.Accept; + while (true) { + /** + * 3.1. While result is not FILTER_REJECT and node has a child: + */ + while (result !== interfaces_1.FilterResult.Reject && node._firstChild) { + /** + * 3.1.1. Set node to its first child. + * 3.1.2. Set result to the result of filtering node within the context + * object. + * 3.1.3. If result is FILTER_ACCEPT, then set the context object’s + * current to node and return node. + */ + node = node._firstChild; + result = algorithm_1.traversal_filter(this, node); + if (result === interfaces_1.FilterResult.Accept) { + this._current = node; + return node; + } + } + /** + * 3.2. Let sibling be null. + * 3.3. Let temporary be node. + * 3.4. While temporary is non-null: + */ + var sibling = null; + var temporary = node; + while (temporary !== null) { + /** + * 3.4.1. If temporary is the context object’s root, then return null. + */ + if (temporary === this._root) { + return null; + } + /** + * 3.4.2. Set sibling to temporary’s next sibling. + * 3.4.3. If sibling is non-null, then break. + */ + sibling = temporary._nextSibling; + if (sibling !== null) { + node = sibling; + break; + } + /** + * 3.4.4. Set temporary to temporary’s parent. + */ + temporary = temporary._parent; + } + /** + * 3.5. Set result to the result of filtering node within the context object. + * 3.6. If result is FILTER_ACCEPT, then set the context object’s current + * to node and return node. + */ + result = algorithm_1.traversal_filter(this, node); + if (result === interfaces_1.FilterResult.Accept) { + this._current = node; + return node; + } + } + }; + /** + * Creates a new `TreeWalker`. + * + * @param root - iterator's root node + * @param current - current node + */ + TreeWalkerImpl._create = function (root, current) { + return new TreeWalkerImpl(root, current); + }; + return TreeWalkerImpl; +}(TraverserImpl_1.TraverserImpl)); +exports.TreeWalkerImpl = TreeWalkerImpl; +//# sourceMappingURL=TreeWalkerImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/TreeWalkerImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/TreeWalkerImpl.js.map new file mode 100644 index 0000000..cd53ba4 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/TreeWalkerImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TreeWalkerImpl.js","sourceRoot":"","sources":["../../src/dom/TreeWalkerImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA6D;AAC7D,iDAA+C;AAC/C,0CAEqB;AAErB;;GAEG;AACH;IAAoC,kCAAa;IAI/C;;OAEG;IACH,wBAAoB,IAAU,EAAE,OAAa;QAA7C,YACE,kBAAM,IAAI,CAAC,SAGZ;QADC,KAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;;IACzB,CAAC;IAGD,sBAAI,uCAAW;QADf,kBAAkB;aAClB,cAA0B,OAAO,IAAI,CAAC,QAAQ,CAAA,CAAC,CAAC;aAChD,UAAgB,KAAW,IAAI,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAA,CAAC,CAAC;;;OADN;IAGhD,kBAAkB;IAClB,mCAAU,GAAV;QACE;;;WAGG;QACH,IAAI,IAAI,GAAgB,IAAI,CAAC,QAAQ,CAAA;QACrC,OAAO,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC,KAAK,EAAE;YAC3C;;;;;eAKG;YACH,IAAI,GAAG,IAAI,CAAC,OAAO,CAAA;YACnB,IAAI,IAAI,KAAK,IAAI;gBACf,4BAAgB,CAAC,IAAI,EAAE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ACH,IAAI,SAAS,KAAK,IAAI,CAAC,KAAK,EAAE;oBAC5B,OAAO,IAAI,CAAA;iBACZ;gBACD;;;mBAGG;gBACH,OAAO,GAAG,SAAS,CAAC,YAAY,CAAA;gBAChC,IAAI,OAAO,KAAK,IAAI,EAAE;oBACpB,IAAI,GAAG,OAAO,CAAA;oBACd,MAAK;iBACN;gBACD;;mBAEG;gBACH,SAAS,GAAG,SAAS,CAAC,OAAO,CAAA;aAC9B;YAED;;;;eAIG;YACH,MAAM,GAAG,4BAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;YACrC,IAAI,MAAM,KAAK,yBAAY,CAAC,MAAM,EAAE;gBAClC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;gBACpB,OAAO,IAAI,CAAA;aACZ;SACF;IACH,CAAC;IAED;;;;;OAKG;IACI,sBAAO,GAAd,UAAe,IAAU,EAAE,OAAa;QACtC,OAAO,IAAI,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC1C,CAAC;IAEH,qBAAC;AAAD,CAAC,AApPD,CAAoC,6BAAa,GAoPhD;AApPY,wCAAc"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/WindowImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/WindowImpl.d.ts new file mode 100644 index 0000000..ee02095 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/WindowImpl.d.ts @@ -0,0 +1,26 @@ +import { Event, Slot, MutationObserver, Document, Window, NodeIterator } from "./interfaces"; +import { EventTargetImpl } from "./EventTargetImpl"; +import { FixedSizeSet } from "@oozcitak/util"; +/** + * Represents a window containing a DOM document. + */ +export declare class WindowImpl extends EventTargetImpl implements Window { + _currentEvent?: Event; + _signalSlots: Set; + _mutationObserverMicrotaskQueued: boolean; + _mutationObservers: Set; + _associatedDocument: Document; + _iteratorList: FixedSizeSet; + /** + * Initializes a new instance of `Window`. + */ + protected constructor(); + /** @inheritdoc */ + get document(): Document; + /** @inheritdoc */ + get event(): Event | undefined; + /** + * Creates a new window with a blank document. + */ + static _create(): WindowImpl; +} diff --git a/node_modules/@oozcitak/dom/lib/dom/WindowImpl.js b/node_modules/@oozcitak/dom/lib/dom/WindowImpl.js new file mode 100644 index 0000000..6bd8603 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/WindowImpl.js @@ -0,0 +1,57 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var EventTargetImpl_1 = require("./EventTargetImpl"); +var util_1 = require("@oozcitak/util"); +var algorithm_1 = require("../algorithm"); +/** + * Represents a window containing a DOM document. + */ +var WindowImpl = /** @class */ (function (_super) { + __extends(WindowImpl, _super); + /** + * Initializes a new instance of `Window`. + */ + function WindowImpl() { + var _this = _super.call(this) || this; + _this._signalSlots = new Set(); + _this._mutationObserverMicrotaskQueued = false; + _this._mutationObservers = new Set(); + _this._iteratorList = new util_1.FixedSizeSet(); + _this._associatedDocument = algorithm_1.create_document(); + return _this; + } + Object.defineProperty(WindowImpl.prototype, "document", { + /** @inheritdoc */ + get: function () { return this._associatedDocument; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WindowImpl.prototype, "event", { + /** @inheritdoc */ + get: function () { return this._currentEvent; }, + enumerable: true, + configurable: true + }); + /** + * Creates a new window with a blank document. + */ + WindowImpl._create = function () { + return new WindowImpl(); + }; + return WindowImpl; +}(EventTargetImpl_1.EventTargetImpl)); +exports.WindowImpl = WindowImpl; +//# sourceMappingURL=WindowImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/WindowImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/WindowImpl.js.map new file mode 100644 index 0000000..45415dd --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/WindowImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"WindowImpl.js","sourceRoot":"","sources":["../../src/dom/WindowImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,qDAAmD;AACnD,uCAA6C;AAC7C,0CAA8C;AAE9C;;GAEG;AACH;IAAgC,8BAAe;IAW7C;;OAEG;IACH;QAAA,YACE,iBAAO,SAGR;QAfD,kBAAY,GAAG,IAAI,GAAG,EAAQ,CAAA;QAC9B,sCAAgC,GAAY,KAAK,CAAA;QACjD,wBAAkB,GAAG,IAAI,GAAG,EAAoB,CAAA;QAIhD,mBAAa,GAAG,IAAI,mBAAY,EAAgB,CAAA;QAQ9C,KAAI,CAAC,mBAAmB,GAAG,2BAAe,EAAE,CAAA;;IAC9C,CAAC;IAGD,sBAAI,gCAAQ;QADZ,kBAAkB;aAClB,cAA2B,OAAO,IAAI,CAAC,mBAAmB,CAAA,CAAC,CAAC;;;OAAA;IAG5D,sBAAI,6BAAK;QADT,kBAAkB;aAClB,cAAiC,OAAO,IAAI,CAAC,aAAa,CAAA,CAAC,CAAC;;;OAAA;IAE5D;;OAEG;IACI,kBAAO,GAAd;QACE,OAAO,IAAI,UAAU,EAAE,CAAA;IACzB,CAAC;IACH,iBAAC;AAAD,CAAC,AAhCD,CAAgC,iCAAe,GAgC9C;AAhCY,gCAAU"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/XMLDocumentImpl.d.ts b/node_modules/@oozcitak/dom/lib/dom/XMLDocumentImpl.d.ts new file mode 100644 index 0000000..4f1a9b6 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/XMLDocumentImpl.d.ts @@ -0,0 +1,11 @@ +import { DocumentImpl } from "./DocumentImpl"; +import { XMLDocument } from "./interfaces"; +/** + * Represents an XML document. + */ +export declare class XMLDocumentImpl extends DocumentImpl implements XMLDocument { + /** + * Initializes a new instance of `XMLDocument`. + */ + constructor(); +} diff --git a/node_modules/@oozcitak/dom/lib/dom/XMLDocumentImpl.js b/node_modules/@oozcitak/dom/lib/dom/XMLDocumentImpl.js new file mode 100644 index 0000000..93fd6a4 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/XMLDocumentImpl.js @@ -0,0 +1,31 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var DocumentImpl_1 = require("./DocumentImpl"); +/** + * Represents an XML document. + */ +var XMLDocumentImpl = /** @class */ (function (_super) { + __extends(XMLDocumentImpl, _super); + /** + * Initializes a new instance of `XMLDocument`. + */ + function XMLDocumentImpl() { + return _super.call(this) || this; + } + return XMLDocumentImpl; +}(DocumentImpl_1.DocumentImpl)); +exports.XMLDocumentImpl = XMLDocumentImpl; +//# sourceMappingURL=XMLDocumentImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/XMLDocumentImpl.js.map b/node_modules/@oozcitak/dom/lib/dom/XMLDocumentImpl.js.map new file mode 100644 index 0000000..485e008 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/XMLDocumentImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"XMLDocumentImpl.js","sourceRoot":"","sources":["../../src/dom/XMLDocumentImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAA6C;AAG7C;;GAEG;AACH;IAAqC,mCAAY;IAE/C;;OAEG;IACH;eACE,iBAAO;IACT,CAAC;IACH,sBAAC;AAAD,CAAC,AARD,CAAqC,2BAAY,GAQhD;AARY,0CAAe"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/index.d.ts b/node_modules/@oozcitak/dom/lib/dom/index.d.ts new file mode 100644 index 0000000..a7b945a --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/index.d.ts @@ -0,0 +1,36 @@ +import { AbortControllerImpl } from "./AbortControllerImpl"; +import { AbortSignalImpl } from "./AbortSignalImpl"; +import { AbstractRangeImpl } from "./AbstractRangeImpl"; +import { AttrImpl } from "./AttrImpl"; +import { CDATASectionImpl } from "./CDATASectionImpl"; +import { CharacterDataImpl } from "./CharacterDataImpl"; +import { CommentImpl } from "./CommentImpl"; +import { CustomEventImpl } from "./CustomEventImpl"; +import { DocumentFragmentImpl } from "./DocumentFragmentImpl"; +import { DocumentImpl } from "./DocumentImpl"; +import { DocumentTypeImpl } from "./DocumentTypeImpl"; +import { dom } from "./DOMImpl"; +import { DOMImplementationImpl } from "./DOMImplementationImpl"; +import { DOMTokenListImpl } from "./DOMTokenListImpl"; +import { ElementImpl } from "./ElementImpl"; +import { EventImpl } from "./EventImpl"; +import { EventTargetImpl } from "./EventTargetImpl"; +import { HTMLCollectionImpl } from "./HTMLCollectionImpl"; +import { MutationObserverImpl } from "./MutationObserverImpl"; +import { MutationRecordImpl } from "./MutationRecordImpl"; +import { NamedNodeMapImpl } from "./NamedNodeMapImpl"; +import { NodeFilterImpl } from "./NodeFilterImpl"; +import { NodeImpl } from "./NodeImpl"; +import { NodeIteratorImpl } from "./NodeIteratorImpl"; +import { NodeListImpl } from "./NodeListImpl"; +import { NodeListStaticImpl } from "./NodeListStaticImpl"; +import { ProcessingInstructionImpl } from "./ProcessingInstructionImpl"; +import { RangeImpl } from "./RangeImpl"; +import { ShadowRootImpl } from "./ShadowRootImpl"; +import { StaticRangeImpl } from "./StaticRangeImpl"; +import { TextImpl } from "./TextImpl"; +import { TraverserImpl } from "./TraverserImpl"; +import { TreeWalkerImpl } from "./TreeWalkerImpl"; +import { WindowImpl } from "./WindowImpl"; +import { XMLDocumentImpl } from "./XMLDocumentImpl"; +export { AbortControllerImpl as AbortController, AbortSignalImpl as AbortSignal, AbstractRangeImpl as AbstractRange, AttrImpl as Attr, CDATASectionImpl as CDATASection, CharacterDataImpl as CharacterData, CommentImpl as Comment, CustomEventImpl as CustomEvent, DocumentFragmentImpl as DocumentFragment, DocumentImpl as Document, DocumentTypeImpl as DocumentType, dom, DOMImplementationImpl as DOMImplementation, DOMTokenListImpl as DOMTokenList, ElementImpl as Element, EventImpl as Event, EventTargetImpl as EventTarget, HTMLCollectionImpl as HTMLCollection, MutationObserverImpl as MutationObserver, MutationRecordImpl as MutationRecord, NamedNodeMapImpl as NamedNodeMap, NodeFilterImpl as NodeFilter, NodeImpl as Node, NodeIteratorImpl as NodeIterator, NodeListImpl as NodeList, NodeListStaticImpl as NodeListStatic, ProcessingInstructionImpl as ProcessingInstruction, RangeImpl as Range, ShadowRootImpl as ShadowRoot, StaticRangeImpl as StaticRange, TextImpl as Text, TraverserImpl as Traverser, TreeWalkerImpl as TreeWalker, WindowImpl as Window, XMLDocumentImpl as XMLDocument }; diff --git a/node_modules/@oozcitak/dom/lib/dom/index.js b/node_modules/@oozcitak/dom/lib/dom/index.js new file mode 100644 index 0000000..7146be4 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/index.js @@ -0,0 +1,102 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var util_1 = require("@oozcitak/util"); +// Import implementation classes +var AbortControllerImpl_1 = require("./AbortControllerImpl"); +exports.AbortController = AbortControllerImpl_1.AbortControllerImpl; +var AbortSignalImpl_1 = require("./AbortSignalImpl"); +exports.AbortSignal = AbortSignalImpl_1.AbortSignalImpl; +var AbstractRangeImpl_1 = require("./AbstractRangeImpl"); +exports.AbstractRange = AbstractRangeImpl_1.AbstractRangeImpl; +var AttrImpl_1 = require("./AttrImpl"); +exports.Attr = AttrImpl_1.AttrImpl; +var CDATASectionImpl_1 = require("./CDATASectionImpl"); +exports.CDATASection = CDATASectionImpl_1.CDATASectionImpl; +var CharacterDataImpl_1 = require("./CharacterDataImpl"); +exports.CharacterData = CharacterDataImpl_1.CharacterDataImpl; +var ChildNodeImpl_1 = require("./ChildNodeImpl"); +var CommentImpl_1 = require("./CommentImpl"); +exports.Comment = CommentImpl_1.CommentImpl; +var CustomEventImpl_1 = require("./CustomEventImpl"); +exports.CustomEvent = CustomEventImpl_1.CustomEventImpl; +var DocumentFragmentImpl_1 = require("./DocumentFragmentImpl"); +exports.DocumentFragment = DocumentFragmentImpl_1.DocumentFragmentImpl; +var DocumentImpl_1 = require("./DocumentImpl"); +exports.Document = DocumentImpl_1.DocumentImpl; +var DocumentOrShadowRootImpl_1 = require("./DocumentOrShadowRootImpl"); +var DocumentTypeImpl_1 = require("./DocumentTypeImpl"); +exports.DocumentType = DocumentTypeImpl_1.DocumentTypeImpl; +var DOMImpl_1 = require("./DOMImpl"); +exports.dom = DOMImpl_1.dom; +var DOMImplementationImpl_1 = require("./DOMImplementationImpl"); +exports.DOMImplementation = DOMImplementationImpl_1.DOMImplementationImpl; +var DOMTokenListImpl_1 = require("./DOMTokenListImpl"); +exports.DOMTokenList = DOMTokenListImpl_1.DOMTokenListImpl; +var ElementImpl_1 = require("./ElementImpl"); +exports.Element = ElementImpl_1.ElementImpl; +var EventImpl_1 = require("./EventImpl"); +exports.Event = EventImpl_1.EventImpl; +var EventTargetImpl_1 = require("./EventTargetImpl"); +exports.EventTarget = EventTargetImpl_1.EventTargetImpl; +var HTMLCollectionImpl_1 = require("./HTMLCollectionImpl"); +exports.HTMLCollection = HTMLCollectionImpl_1.HTMLCollectionImpl; +var MutationObserverImpl_1 = require("./MutationObserverImpl"); +exports.MutationObserver = MutationObserverImpl_1.MutationObserverImpl; +var MutationRecordImpl_1 = require("./MutationRecordImpl"); +exports.MutationRecord = MutationRecordImpl_1.MutationRecordImpl; +var NamedNodeMapImpl_1 = require("./NamedNodeMapImpl"); +exports.NamedNodeMap = NamedNodeMapImpl_1.NamedNodeMapImpl; +var NodeFilterImpl_1 = require("./NodeFilterImpl"); +exports.NodeFilter = NodeFilterImpl_1.NodeFilterImpl; +var NodeImpl_1 = require("./NodeImpl"); +exports.Node = NodeImpl_1.NodeImpl; +var NodeIteratorImpl_1 = require("./NodeIteratorImpl"); +exports.NodeIterator = NodeIteratorImpl_1.NodeIteratorImpl; +var NodeListImpl_1 = require("./NodeListImpl"); +exports.NodeList = NodeListImpl_1.NodeListImpl; +var NodeListStaticImpl_1 = require("./NodeListStaticImpl"); +exports.NodeListStatic = NodeListStaticImpl_1.NodeListStaticImpl; +var NonDocumentTypeChildNodeImpl_1 = require("./NonDocumentTypeChildNodeImpl"); +var NonElementParentNodeImpl_1 = require("./NonElementParentNodeImpl"); +var ParentNodeImpl_1 = require("./ParentNodeImpl"); +var ProcessingInstructionImpl_1 = require("./ProcessingInstructionImpl"); +exports.ProcessingInstruction = ProcessingInstructionImpl_1.ProcessingInstructionImpl; +var RangeImpl_1 = require("./RangeImpl"); +exports.Range = RangeImpl_1.RangeImpl; +var ShadowRootImpl_1 = require("./ShadowRootImpl"); +exports.ShadowRoot = ShadowRootImpl_1.ShadowRootImpl; +var SlotableImpl_1 = require("./SlotableImpl"); +var StaticRangeImpl_1 = require("./StaticRangeImpl"); +exports.StaticRange = StaticRangeImpl_1.StaticRangeImpl; +var TextImpl_1 = require("./TextImpl"); +exports.Text = TextImpl_1.TextImpl; +var TraverserImpl_1 = require("./TraverserImpl"); +exports.Traverser = TraverserImpl_1.TraverserImpl; +var TreeWalkerImpl_1 = require("./TreeWalkerImpl"); +exports.TreeWalker = TreeWalkerImpl_1.TreeWalkerImpl; +var WindowImpl_1 = require("./WindowImpl"); +exports.Window = WindowImpl_1.WindowImpl; +var XMLDocumentImpl_1 = require("./XMLDocumentImpl"); +exports.XMLDocument = XMLDocumentImpl_1.XMLDocumentImpl; +// Apply mixins +// ChildNode +util_1.applyMixin(ElementImpl_1.ElementImpl, ChildNodeImpl_1.ChildNodeImpl); +util_1.applyMixin(CharacterDataImpl_1.CharacterDataImpl, ChildNodeImpl_1.ChildNodeImpl); +util_1.applyMixin(DocumentTypeImpl_1.DocumentTypeImpl, ChildNodeImpl_1.ChildNodeImpl); +// DocumentOrShadowRoot +util_1.applyMixin(DocumentImpl_1.DocumentImpl, DocumentOrShadowRootImpl_1.DocumentOrShadowRootImpl); +util_1.applyMixin(ShadowRootImpl_1.ShadowRootImpl, DocumentOrShadowRootImpl_1.DocumentOrShadowRootImpl); +// NonDocumentTypeChildNode +util_1.applyMixin(ElementImpl_1.ElementImpl, NonDocumentTypeChildNodeImpl_1.NonDocumentTypeChildNodeImpl); +util_1.applyMixin(CharacterDataImpl_1.CharacterDataImpl, NonDocumentTypeChildNodeImpl_1.NonDocumentTypeChildNodeImpl); +// NonElementParentNode +util_1.applyMixin(DocumentImpl_1.DocumentImpl, NonElementParentNodeImpl_1.NonElementParentNodeImpl); +util_1.applyMixin(DocumentFragmentImpl_1.DocumentFragmentImpl, NonElementParentNodeImpl_1.NonElementParentNodeImpl); +// ParentNode +util_1.applyMixin(DocumentImpl_1.DocumentImpl, ParentNodeImpl_1.ParentNodeImpl); +util_1.applyMixin(DocumentFragmentImpl_1.DocumentFragmentImpl, ParentNodeImpl_1.ParentNodeImpl); +util_1.applyMixin(ElementImpl_1.ElementImpl, ParentNodeImpl_1.ParentNodeImpl); +// Slotable +util_1.applyMixin(TextImpl_1.TextImpl, SlotableImpl_1.SlotableImpl); +util_1.applyMixin(ElementImpl_1.ElementImpl, SlotableImpl_1.SlotableImpl); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/index.js.map b/node_modules/@oozcitak/dom/lib/dom/index.js.map new file mode 100644 index 0000000..7c11706 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRo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,CAAA;AACxC,iBAAU,CAAC,2CAAoB,EAAE,+BAAc,CAAC,CAAA;AAChD,iBAAU,CAAC,yBAAW,EAAE,+BAAc,CAAC,CAAA;AACvC,WAAW;AACX,iBAAU,CAAC,mBAAQ,EAAE,2BAAY,CAAC,CAAA;AAClC,iBAAU,CAAC,yBAAW,EAAE,2BAAY,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/interfaces.d.ts b/node_modules/@oozcitak/dom/lib/dom/interfaces.d.ts new file mode 100644 index 0000000..8510575 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/interfaces.d.ts @@ -0,0 +1,2218 @@ +import { FixedSizeSet } from "@oozcitak/util"; +import { URLRecord } from "@oozcitak/url/lib/interfaces"; +/** + * Defines DOM features supported by algorithms. + */ +export declare type DOMFeatures = { + /** + * Enables or disables mutation observer algorithms. + */ + mutationObservers: boolean; + /** + * Enables or disables custom element algorithms. + */ + customElements: boolean; + /** + * Enables or disables slot algorithms. + */ + slots: boolean; + /** + * Enables or disables various run steps defined in algorithms. + */ + steps: boolean; + [key: string]: boolean; +}; +/** + * Represents a window containing a DOM document. + */ +export interface Window extends EventTarget { + /** + * Returns the Event which is currently being handled. + * + * _Note:_ Note: This property can be fragile, in that there may be situations + * in which the returned Event is not the expected value. In addition, + * Window.event is not accurate for events dispatched within shadow trees. + */ + readonly event?: Event; + /** + * Returns the associated Document. + */ + readonly document: Document; + _currentEvent?: Event; + _signalSlots: Set; + _mutationObserverMicrotaskQueued: boolean; + _mutationObservers: Set; + _associatedDocument: Document; + _iteratorList: FixedSizeSet; +} +/** + * Represents a DOM event. + */ +export interface Event { + NONE: number; + CAPTURING_PHASE: number; + AT_TARGET: number; + BUBBLING_PHASE: number; + /** + * Returns the type of event. + */ + readonly type: string; + /** + * Returns the object to which event is dispatched (its target). + */ + readonly target: EventTarget | null; + /** + * Historical alias of target. + */ + readonly srcElement: EventTarget | null; + /** + * Returns the object whose event listener's callback is currently + * being invoked. + */ + readonly currentTarget: EventTarget | null; + /** + * Returns the event's path (objects on which listeners will be + * invoked). This does not include nodes in shadow trees if the + * shadow root was created with its `mode` `"closed"`. + */ + composedPath(): EventTarget[]; + /** + * Returns the event's phase. + */ + readonly eventPhase: EventPhase; + /** + * Prevents event from reaching any objects other than the current + * object. + */ + stopPropagation(): void; + /** + * Historical alias of `stopPropagation()`. + */ + cancelBubble: boolean; + /** + * Prevents event from reaching any registered event listeners after + * the current one finishes running. + */ + stopImmediatePropagation(): void; + /** + * Returns `true` if the event goes through its target's ancestors in + * reverse tree order, and `false` otherwise. + */ + readonly bubbles: boolean; + /** + * A historical alias of `stopPropagation()`. + */ + readonly cancelable: boolean; + /** + * Historical property. + */ + returnValue: boolean; + /** + * Cancels the event (if it is cancelable). + */ + preventDefault(): void; + /** + * Indicates whether the event was cancelled with `preventDefault()`. + */ + readonly defaultPrevented: boolean; + /** + * Determines whether the event can bubble to the shadow DOM. + */ + readonly composed: boolean; + /** + * Returns `true` if event was dispatched by the user agent, and + * `false` otherwise. + */ + readonly isTrusted: boolean; + /** + * Returns the the number of milliseconds measured relative to the + * time origin. + */ + readonly timeStamp: number; + /** + * Historical method to initializes the value of an event. + * + * @param type - the type of event. + * @param bubbles - whether the event propagates in reverse. + * @param cancelable - whether the event can be cancelled. + */ + initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void; + _target: PotentialEventTarget; + _relatedTarget: PotentialEventTarget; + _touchTargetList: PotentialEventTarget[]; + _path: EventPathItem[]; + _stopPropagationFlag: boolean; + _stopImmediatePropagationFlag: boolean; + _canceledFlag: boolean; + _inPassiveListenerFlag: boolean; + _composedFlag: boolean; + _initializedFlag: boolean; + _dispatchFlag: boolean; + _isTrusted: boolean; + _currentTarget: PotentialEventTarget; + _eventPhase: EventPhase; + _type: string; + _bubbles: boolean; + _cancelable: boolean; + _timeStamp: number; +} +/** + * Represents and event that carries custom data. + */ +export interface CustomEvent extends Event { + /** + * Gets custom event data. + */ + readonly detail: any; + /** + * Initializes the value of an event. + * + * @param type - the type of event. + * @param bubbles - whether the event propagates in reverse. + * @param cancelable - whether the event can be cancelled. + * @param detail - custom event data + */ + initCustomEvent(type: string, bubbles?: boolean, cancelable?: boolean, detail?: any): void; +} +/** + * Represents an object that is used to observe mutations to the node tree. + */ +export interface MutationObserver { + /** + * Observes a given target and reports any mutations based on options. + * + * @param target - the node to observe + * @param options - mutation criteria to observe + */ + observe(target: Node, options?: MutationObserverInit): void; + /** + * Stops observing mutations. + */ + disconnect(): void; + /** + * Returns the list of mutations. + */ + takeRecords(): MutationRecord[]; + _callback: MutationCallback; + _nodeList: Node[]; + _recordQueue: MutationRecord[]; +} +/** + * Represents a mutation record. + */ +export interface MutationRecord { + /** + * Returns `"attributes"` if it was an attribute mutation, + * `"characterData"` if it was a mutation to a CharacterData node, + * and `"childList"` if it was a mutation to the tree of nodes. + */ + readonly type: "attributes" | "characterData" | "childList"; + /** + * Returns the node the mutation affected. + */ + readonly target: Node; + /** + * Returns a list of added nodes. + */ + readonly addedNodes: NodeList; + /** + * Returns a list of removed nodes. + */ + readonly removedNodes: NodeList; + /** + * Returns the previous sibling of added or removed nodes. + */ + readonly previousSibling: Node | null; + /** + * Returns the next sibling of added or removed nodes. + */ + readonly nextSibling: Node | null; + /** + * Returns the local name of the changed attribute, and `null` otherwise. + */ + readonly attributeName: string | null; + /** + * Returns the namespace of the changed attribute, and `null` otherwise. + */ + readonly attributeNamespace: string | null; + /** + * Returns a value depending on `type`: + * * For `"attributes"` the attribute value before the change, + * * For `"characterData"` node `data` before the change, + * * For `"childList"` `null`. + */ + readonly oldValue: string | null; +} +/** + * Represents an object that receive event notifications. + */ +export interface EventListener { + /** + * A callback function that is called when an event occurs. + * + * @param event - the event to handle. + */ + handleEvent: (event: Event) => void; +} +/** + * Represents an object that can receive events. + */ +export interface EventTarget { + /** + * Registers an event handler. + * + * @param type - event type to listen for. + * @param callback - object to receive a notification when an event occurs. + * @param options - object that specifies event characteristics. + */ + addEventListener(type: string, callback: EventListener | null | ((event: Event) => void), options?: { + passive: boolean; + once: boolean; + capture: boolean; + } | boolean): void; + /** + * Removes an event listener. + * + * @param type - event type to listen for. + * @param callback - object to receive a notification when an event occurs. + * @param options - object that specifies event characteristics. + */ + removeEventListener(type: string, callback: EventListener | null | ((event: Event) => void), options?: { + capture: boolean; + } | boolean): void; + /** + * Dispatches an event to this event target. + * + * @param event - the event to dispatch. + */ + dispatchEvent(event: Event): boolean; + _eventListenerList: EventListenerEntry[]; + _eventHandlerMap: { + [key: string]: EventHandlerEntry; + }; + /** + * Gets the parent event target for the given event. + * + * @param event - an event + */ + _getTheParent(event: Event): EventTarget | null; + /** + * Defines optional activation behavior for the given event. + * + * _Note:_ This exists because user agents perform certain actions for certain + * EventTarget objects, e.g., the area element, in response to synthetic + * MouseEvent events whose type attribute is click. Web compatibility + * prevented it from being removed and it is now the enshrined way of + * defining an activation of something. + * + * @param event - an event + */ + _activationBehavior?(event: Event): void; + /** + * Defines optional legacy pre-activation behavior for the given event. + * + * _Note:_ These algorithms only exist for checkbox and radio input elements + * and are not to be used for anything else. + * + * @param event - an event + */ + _legacyPreActivationBehavior?(event: Event): void; + /** + * Defines optional legacy canceled activation behavior for the given event. + * + * _Note:_ These algorithms only exist for checkbox and radio input elements + * and are not to be used for anything else. + * + * @param event - an event + */ + _legacyCanceledActivationBehavior?(event: Event): void; +} +/** + * Represents a controller that allows to abort DOM requests. + */ +export interface AbortController { + /** + * Returns the AbortSignal object associated with this object. + */ + readonly signal: AbortSignal; + /** + * Sets the aborted flag and signals any observers that the associated + * activity is to be aborted. + */ + abort(): void; + _signal: AbortSignal; +} +/** + * Represents a signal object that communicates with a DOM request and abort + * it through an AbortController. + */ +export interface AbortSignal extends EventTarget { + /** + * Returns `true` if the controller is to abort, and `false` otherwise. + */ + readonly aborted: boolean; + /** + * Raises an event when the controller has aborted. + */ + onabort: EventHandler; + _abortedFlag: boolean; + _abortAlgorithms: Set<(...args: any[]) => any>; +} +/** + * Represents a generic XML node. + */ +export interface Node extends EventTarget { + ELEMENT_NODE: number; + ATTRIBUTE_NODE: number; + TEXT_NODE: number; + CDATA_SECTION_NODE: number; + ENTITY_REFERENCE_NODE: number; + ENTITY_NODE: number; + PROCESSING_INSTRUCTION_NODE: number; + COMMENT_NODE: number; + DOCUMENT_NODE: number; + DOCUMENT_TYPE_NODE: number; + DOCUMENT_FRAGMENT_NODE: number; + NOTATION_NODE: number; + DOCUMENT_POSITION_DISCONNECTED: number; + DOCUMENT_POSITION_PRECEDING: number; + DOCUMENT_POSITION_FOLLOWING: number; + DOCUMENT_POSITION_CONTAINS: number; + DOCUMENT_POSITION_CONTAINED_BY: number; + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + /** + * Returns the type of node. + */ + readonly nodeType: NodeType; + /** + * Returns a string appropriate for the type of node. + */ + readonly nodeName: string; + /** + * Gets the absolute base URL of the node. + */ + readonly baseURI: string; + /** + * Returns whether the node is rooted to a document node. + */ + readonly isConnected: boolean; + /** + * Returns the parent document. + */ + readonly ownerDocument: Document | null; + /** + * Returns the root node. + * + * @param options - if options has `composed = true` this function + * returns the node's shadow-including root, otherwise it returns + * the node's root node. + */ + getRootNode(options?: GetRootNodeOptions): Node; + /** + * Returns the parent node. + */ + readonly parentNode: Node | null; + /** + * Returns the parent element. + */ + readonly parentElement: Element | null; + /** + * Determines whether a node has any children. + */ + hasChildNodes(): boolean; + /** + * Returns a {@link NodeList} of child nodes. + */ + readonly childNodes: NodeList; + /** + * Returns the first child node. + */ + readonly firstChild: Node | null; + /** + * Returns the last child node. + */ + readonly lastChild: Node | null; + /** + * Returns the previous sibling node. + */ + readonly previousSibling: Node | null; + /** + * Returns the next sibling node. + */ + readonly nextSibling: Node | null; + /** + * Gets or sets the data associated with a {@link CharacterData} node. + * For other node types returns `null`. + */ + nodeValue: string | null; + /** + * Returns the concatenation of data of all the {@link CharacterData} + * node descendants in tree order. When set, replaces the text + * contents of the node with the given value. + */ + textContent: string | null; + /** + * Puts all {@link Text} nodes in the full depth of the sub-tree + * underneath this node into a "normal" form where only markup + * (e.g., tags, comments, processing instructions, CDATA sections, + * and entity references) separates {@link Text} nodes, i.e., there + * are no adjacent text nodes. + */ + normalize(): void; + /** + * Returns a duplicate of this node, i.e., serves as a generic copy + * constructor for nodes. The duplicate node has no parent + * ({@link parentNode} returns `null`). + * + * @param deep - if `true`, recursively clone the subtree under the + * specified node if `false`, clone only the node itself (and its + * attributes, if it is an {@link Element}). + */ + cloneNode(deep?: boolean): Node; + /** + * Determines if the given node is equal to this one. + * + * @param node - the node to compare with + */ + isEqualNode(node?: Node | null): boolean; + /** + * Determines if the given node is reference equal to this one. + * + * @param node - the node to compare with + */ + isSameNode(node?: Node | null): boolean; + /** + * Returns a bitmask indicating the position of the given `node` + * relative to this node. + */ + compareDocumentPosition(node: Node): Position; + /** + * Returns `true` if given node is an inclusive descendant of this + * node, and `false` otherwise (including when other node is `null`). + * + * @param node - the node to check + */ + contains(node: Node | null): boolean; + /** + * Returns the prefix for a given namespace URI, if present, and + * `null` if not. + * + * @param namespace - the namespace to search + */ + lookupPrefix(namespace: string | null): string | null; + /** + * Returns the namespace URI for a given prefix if present, and `null` + * if not. + * + * @param prefix - the prefix to search + */ + lookupNamespaceURI(prefix: string | null): string | null; + /** + * Returns `true` if the namespace is the default namespace on this + * node or `false` if not. + * + * @param namespace - the namespace to check + */ + isDefaultNamespace(namespace: string | null): boolean; + /** + * Inserts the node `newChild` before the existing child node + * `refChild`. If `refChild` is `null`, inserts `newChild` at the end + * of the list of children. + * + * If `newChild` is a {@link DocumentFragment} object, all of its + * children are inserted, in the same order, before `refChild`. + * + * If `newChild` is already in the tree, it is first removed. + * + * @param newChild - the node to insert + * @param refChild - the node before which the new node must be + * inserted + * + * @returns the newly inserted child node + */ + insertBefore(newChild: Node, refChild: Node | null): Node; + /** + * Adds the node `newChild` to the end of the list of children of this + * node, and returns it. If `newChild` is already in the tree, it is + * first removed. + * + * If `newChild` is a {@link DocumentFragment} object, the entire + * contents of the document fragment are moved into the child list of + * this node. + * + * @param newChild - the node to add + * + * @returns the newly inserted child node + */ + appendChild(newChild: Node): Node; + /** + * Replaces the child node `oldChild` with `newChild` in the list of + * children, and returns the `oldChild` node. If `newChild` is already + * in the tree, it is first removed. + * + * @param newChild - the new node to put in the child list + * @param oldChild - the node being replaced in the list + * + * @returns the removed child node + */ + replaceChild(newChild: Node, oldChild: Node): Node; + /** + * Removes the child node indicated by `oldChild` from the list of + * children, and returns it. + * + * @param oldChild - the node being removed from the list + * + * @returns the removed child node + */ + removeChild(oldChild: Node): Node; + _nodeDocument: Document; + _registeredObserverList: Array; + /** + * Used to keep track of parent-child relations in the tree. These are + * non-standard properties. + */ + _nodeType: NodeType; + _parent: Node | null; + _children: Set; + _firstChild: Node | null; + _lastChild: Node | null; + _previousSibling: Node | null; + _nextSibling: Node | null; +} +/** + * Represents a generic text node. + */ +export interface CharacterData extends Node, NonDocumentTypeChildNode, ChildNode { + /** + * Gets or sets the text data of the node. + */ + data: string; + /** + * Returns the number of code units in {@link data}. + */ + readonly length: number; + /** + * Returns `count` number of characters from node data starting at + * the given `offset`. + * + * @param offset - the offset at which retrieval starts + * @param count - the number of characters to return + */ + substringData(offset: number, count: number): string; + /** + * Appends the given string to text data of the node. + * + * @param data - the string of text to add to node data + */ + appendData(data: string): void; + /** + * Inserts the given string into the text data of the node starting at + * the given `offset`. + * + * @param offset - the offset at which insertion starts + * @param data - the string of text to add to node data + */ + insertData(offset: number, data: string): void; + /** + * Deletes `count` number of characters from node data starting at + * the given `offset`. + * + * @param offset - the offset at which removal starts + * @param count - the number of characters to delete + */ + deleteData(offset: number, count: number): void; + /** + * Deletes `count` number of characters from node data starting at + * the given `offset` and replaces it with the given `data`. + * + * @param offset - the offset at which removal starts + * @param count - the number of characters to delete + * @param data - the string of text to add to node data + */ + replaceData(offset: number, count: number, data: string): void; + _data: string; +} +/** + * Represents a text node. + */ +export interface Text extends CharacterData, Slotable { + /** + * Splits data at the given offset and returns the remainder as a text + * node. + * + * @param offset - the offset at which to split nodes. + */ + splitText(offset: number): Text; + /** + * Returns the combined data of all direct text node siblings. + */ + readonly wholeText: string; +} +/** + * Represents a collection of elements. + */ +export interface HTMLCollection extends Collection, Iterable { + /** + * Returns the number of elements in the collection. + */ + readonly length: number; + /** + * Returns the element with index `index` from the collection. + * + * @param index - the zero-based index of the element to return + */ + item(index: number): Element | null; + /** + * Returns the first element with ID or name `name` from the + * collection. + * + * @param name - the name of the element to return + */ + namedItem(name: string): Element | null; + /** + * Returns the element with index index from the collection. The + * elements are sorted in tree order. + */ + [index: number]: Element | undefined; + [key: string]: any; +} +/** + * Represents a document node. + */ +export interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, ParentNode { + /** + * Returns the {@link DOMImplementation} object that is associated + * with the document. + */ + readonly implementation: DOMImplementation; + /** + * Returns the document's URL. + */ + readonly URL: string; + /** + * Gets or sets the document's URL. + */ + readonly documentURI: string; + /** + * Returns the document's origin. + */ + readonly origin: string; + /** + * Returns whether the document is rendered in Quirks mode or + * Standards mode. + */ + readonly compatMode: string; + /** + * Returns the character set. + */ + readonly characterSet: string; + /** + * Gets or sets the character set. + */ + readonly charset: string; + /** + * Returns the character set. + */ + readonly inputEncoding: string; + /** + * Returns the MIME type of the document. + */ + readonly contentType: string; + /** + * Returns the {@link DocType} or `null` if there is none. + */ + readonly doctype: DocumentType | null; + /** + * Returns the document element or `null` if there is none. + */ + readonly documentElement: Element | null; + /** + * Returns a {@link HTMLCollection} of all descendant elements + * whose qualified name is `qualifiedName`. + * + * @param qualifiedName - the qualified name to match or `*` to match all + * descendant elements. + * + * @returns an {@link HTMLCollection} of matching descendant + * elements + */ + getElementsByTagName(qualifiedName: string): HTMLCollection; + /** + * Returns a {@link HTMLCollection} of all descendant elements + * whose namespace is `namespace` and local name is `localName`. + * + * @param namespace - the namespace to match or `*` to match any + * namespace. + * @param localName - the local name to match or `*` to match any + * local name. + * + * @returns an {@link HTMLCollection} of matching descendant + * elements + */ + getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollection; + /** + * Returns a {@link HTMLCollection} of all descendant elements + * whose classes are contained in the list of classes given in + * `classNames`. + * + * @param classNames - a space-separated list of classes + * + * @returns an {@link HTMLCollection} of matching descendant + * elements + */ + getElementsByClassName(classNames: string): HTMLCollection; + /** + * Returns a new {@link Element} with the given `localName`. + * + * @param localName - local name + * @param options - element options + * + * @returns the new {@link Element} + */ + createElement(localName: string, options?: string | { + is: string; + }): Element; + /** + * Returns a new {@link Element} with the given `namespace` and + * `qualifiedName`. + * + * @param namespace - namespace URL + * @param qualifiedName - qualified name + * @param options - element options + * + * @returns the new {@link Element} + */ + createElementNS(namespace: string | null, qualifiedName: string, options?: string | { + is: string; + }): Element; + /** + * Returns a new {@link DocumentFragment}. + * + * @returns the new {@link DocumentFragment} + */ + createDocumentFragment(): DocumentFragment; + /** + * Returns a new {@link Text} with the given `data`. + * + * @param data - text content + * + * @returns the new {@link Text} + */ + createTextNode(data: string): Text; + /** + * Returns a new {@link CDATASection} with the given `data`. + * + * @param data - text content + * + * @returns the new {@link CDATASection} + */ + createCDATASection(data: string): CDATASection; + /** + * Returns a new {@link Comment} with the given `data`. + * + * @param data - text content + * + * @returns the new {@link Comment} + */ + createComment(data: string): Comment; + /** + * Returns a new {@link ProcessingInstruction} with the given `target` + * and `data`. + * + * @param target - instruction target + * @param data - text content + * + * @returns the new {@link ProcessingInstruction} + */ + createProcessingInstruction(target: string, data: string): ProcessingInstruction; + /** + * Returns a copy of `node`. + * + * @param deep - true to include descendant nodes. + * + * @returns clone of node + */ + importNode(node: Node, deep?: boolean): Node; + /** + * Moves `node` from another document into this document and returns + * it. + * + * @param node - node to move. + * + * @returns the adopted node + */ + adoptNode(node: Node): Node; + /** + * Returns a new {@link Attr} with the given `localName`. + * + * @param localName - local name + * + * @returns the new {@link Attr} + */ + createAttribute(localName: string): Attr; + /** + * Returns a new {@link Attr} with the given `namespace` and + * `qualifiedName`. + * + * @param namespace - namespace URL + * @param qualifiedName - qualified name + * + * @returns the new {@link Attr} + */ + createAttributeNS(namespace: string | null, qualifiedName: string): Attr; + /** + * Creates an event of the type specified. + * + * @param eventInterface - a string representing the type of event + * to be created + */ + createEvent(eventInterface: string): Event; + /** + * Creates a new Range object. + */ + createRange(): Range; + /** + * Creates a new `NodeIterator` object. + * @param root - the node to which the iterator is attached. + * @param whatToShow - a filter on node type. + * @param filter - a user defined filter. + */ + createNodeIterator(root: Node, whatToShow?: WhatToShow, filter?: NodeFilter | ((node: Node) => FilterResult) | null): NodeIterator; + /** + * Creates a new `TreeWalker` object. + * @param root - the node to which the iterator is attached. + * @param whatToShow - a filter on node type. + * @param filter - a user defined filter. + */ + createTreeWalker(root: Node, whatToShow?: WhatToShow, filter?: NodeFilter | ((node: Node) => FilterResult) | null): TreeWalker; + _encoding: { + name: string; + labels: string[]; + }; + _contentType: string; + _URL: URLRecord; + _origin: Origin; + _type: "xml" | "html"; + _mode: "no-quirks" | "quirks" | "limited-quirks"; + _documentElement: Element | null; + _hasNamespaces: boolean; +} +/** + * Represents an XML document. + */ +export interface XMLDocument extends Document { +} +/** + * Represents a document fragment in the XML tree. + */ +export interface DocumentFragment extends Node, NonElementParentNode, ParentNode { + _host: Element | null; +} +/** + * Represents a shadow root. + */ +export interface ShadowRoot extends DocumentFragment, DocumentOrShadowRoot { + /** + * Gets the shadow root's mode. + */ + readonly mode: ShadowRootMode; + /** + * Gets the shadow root's host. + */ + readonly host: Element; + _host: Element; + _mode: ShadowRootMode; +} +/** + * Represents an element node. + */ +export interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode, Slotable { + /** + * Gets the namespace URI. + */ + readonly namespaceURI: string | null; + /** + * Gets the namespace prefix. + */ + readonly prefix: string | null; + /** + * Gets the local name. + */ + readonly localName: string; + /** + * If namespace prefix is not `null`, returns the concatenation of + * namespace prefix, `":"`, and local name. Otherwise it returns the + * local name. + */ + readonly tagName: string; + /** + * Gets or sets the identifier of this element. + */ + id: string; + /** + * Gets or sets the class name of this element. + */ + className: string; + /** + * Returns a {@link DOMTokenList} with tokens from the class + * attribute. + */ + readonly classList: DOMTokenList; + /** + * Gets or sets the slot attribute of this element. + */ + slot: string; + /** + * Determines if the element node contains any attributes. + */ + hasAttributes(): boolean; + /** + * Returns a {@link NamedNodeMap} of attributes. + */ + readonly attributes: NamedNodeMap; + /** + * Returns the list of all attribute's qualified names. + */ + getAttributeNames(): string[]; + /** + * Returns the value of the attribute with the given `name`. + * + * @param qualifiedName - attribute name + */ + getAttribute(qualifiedName: string): string | null; + /** + * Returns the value of the attribute with the given `namespace` and + * `localName`. + * + * @param namespace - namespace to search for + * @param localName - local name to search for + */ + getAttributeNS(namespace: string | null, localName: string): string | null; + /** + * Sets the value of the attribute with the given `name`. + * + * @param qualifiedName - attribute name + * @param value - attribute value to set + */ + setAttribute(qualifiedName: string, value: string): void; + /** + * Sets the value of the attribute with the given `namespace` and + * `qualifiedName`. + * + * @param namespace - namespace to search for + * @param qualifiedName - qualified name to search for + * @param value - attribute value to set + */ + setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void; + /** + * Removes the attribute with the given `name`. + * + * @param qualifiedName - attribute name + */ + removeAttribute(qualifiedName: string): void; + /** + * Removes the attribute with the given `namespace` and `localName`. + * + * @param namespace - namespace to search for + * @param localName - local name to search for + */ + removeAttributeNS(namespace: string | null, localName: string): void; + /** + * Determines whether the attribute with the given `name` exists. + * + * @param qualifiedName - attribute name + */ + hasAttribute(qualifiedName: string): boolean; + /** + * Toggles a boolean attribute (removing it if it is present and adding it + * if it is not present). + * + * @param qualifiedName - attribute name + * @param force - whether the attribute should be added or removed, + * no matter whether the attribute is present or not + */ + toggleAttribute(qualifiedName: string, force?: boolean): boolean; + /** + * Determines whether the attribute with the given `namespace` and + * `localName` exists. + * + * @param namespace - namespace to search for + * @param localName - local name to search for + */ + hasAttributeNS(namespace: string | null, localName: string): boolean; + /** + * Returns the attribute with the given `name`. + * + * @param qualifiedName - attribute name + */ + getAttributeNode(qualifiedName: string): Attr | null; + /** + * Returns the attribute with the given `namespace` and + * `localName`. + * + * @param namespace - namespace to search for + * @param localName - local name to search for + */ + getAttributeNodeNS(namespace: string | null, localName: string): Attr | null; + /** + * Sets the attribute given with `attr`. + * + * @param attr - attribute to set + */ + setAttributeNode(attr: Attr): Attr | null; + /** + * Sets the attribute given with `attr`. + * + * @param attr - attribute to set + */ + setAttributeNodeNS(attr: Attr): Attr | null; + /** + * Removes the given attribute. + * + * @param attr - attribute to remove + */ + removeAttributeNode(attr: Attr): Attr; + /** + * Creates a shadow root for element and returns it. + * + * @param init - A ShadowRootInit dictionary. + */ + attachShadow(init: { + mode: ShadowRootMode; + }): ShadowRoot; + /** + * Returns element's shadow root, if any, and if shadow root's mode + * is `"open"`, and null otherwise. + */ + readonly shadowRoot: ShadowRoot | null; + /** + * Returns the first (starting at element) inclusive ancestor that + * matches selectors, and `null` otherwise. + * + * @param selectors + */ + closest(selectors: string): Element | null; + /** + * Returns `true` if matching selectors against element's root yields + * element, and `false` otherwise. + * + * @param selectors + */ + matches(selectors: string): boolean; + /** + * Historical alias of `matches`. + */ + webkitMatchesSelector(selectors: string): boolean; + /** + * Returns a {@link HTMLCollection} of all descendant elements + * whose qualified name is `qualifiedName`. + * + * @param qualifiedName - the qualified name to match or `*` to match + * all descendant elements. + * + * @returns an {@link HTMLCollection} of matching descendant + * elements + */ + getElementsByTagName(qualifiedName: string): HTMLCollection; + /** + * Returns a {@link HTMLCollection} of all descendant elements + * whose namespace is `namespace` and local name is `localName`. + * + * @param namespace - the namespace to match or `*` to match any + * namespace. + * @param localName - the local name to match or `*` to match any + * local name. + * + * @returns an {@link HTMLCollection} of matching descendant + * elements + */ + getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollection; + /** + * Returns a {@link HTMLCollection} of all descendant elements + * whose classes are contained in the list of classes given in + * `classNames`. + * + * @param classNames - a space-separated list of classes + * + * @returns an {@link HTMLCollection} of matching descendant + * elements + */ + getElementsByClassName(classNames: string): HTMLCollection; + /** + * Inserts a given element node at a given position relative to this + * node. + * + * @param where - a string defining where to insert the element node. + * - `beforebegin` before this element itself. + * - `afterbegin` before the first child. + * - `beforeend` after the last child. + * - `afterend` after this element itself. + * @param element - the element to insert + * + * @returns the inserted element + */ + insertAdjacentElement(where: "beforebegin" | "afterbegin" | "beforeend" | "afterend", element: Element): Element | null; + /** + * Inserts a given text node at a given position relative to this + * node. + * + * @param where - a string defining where to insert the element node. + * - `beforebegin` before this element itself. + * - `afterbegin` before the first child. + * - `beforeend` after the last child. + * - `afterend` after this element itself. + * @param data - text node data + * + * @returns the inserted element + */ + insertAdjacentText(where: "beforebegin" | "afterbegin" | "beforeend" | "afterend", data: string): void; + _namespace: string | null; + _namespacePrefix: string | null; + _localName: string; + _customElementState: "undefined" | "failed" | "uncustomized" | "custom"; + _customElementDefinition: CustomElementDefinition | null; + _is: string | null; + _shadowRoot: ShadowRoot | null; + readonly _qualifiedName: string; + readonly _htmlUppercasedQualifiedName: string; + _attributeList: NamedNodeMap; + _attributeChangeSteps: AttributeChangeStep[]; + _uniqueIdentifier?: string; +} +/** + * Represents an object providing methods which are not dependent on + * any particular document + */ +export interface DocumentType extends Node, ChildNode { + /** + * Returns the name of the node. + */ + readonly name: string; + /** + * Returns the `PUBLIC` identifier of the node. + */ + readonly publicId: string; + /** + * Returns the `SYSTEM` identifier of the node. + */ + readonly systemId: string; + _name: string; + _publicId: string; + _systemId: string; +} +/** + * Represents a mixin that extends non-element parent nodes. This mixin + * is implemented by {@link Document} and {@link DocumentFragment}. + */ +export interface NonElementParentNode { + /** + * Returns an {@link Element} who has an id attribute `elementId`. + * + * @param id - the value of the `id` attribute to match + */ + getElementById(id: string): Element | null; +} +/** + * Represents a mixin for an interface to be used to share APIs between + * documents and shadow roots. This mixin is implemented by + * {@link Document} and {@link ShadowRoot}. + */ +export interface DocumentOrShadowRoot { +} +/** + * Represents a mixin that extends parent nodes that can have children. + * This mixin is implemented by {@link Element}, {@link Document} and + * {@link DocumentFragment}. + */ +export interface ParentNode { + /** + * Returns the child elements. + */ + readonly children: HTMLCollection; + /** + * Returns the first child that is an element, and `null` otherwise. + */ + readonly firstElementChild: Element | null; + /** + * Returns the last child that is an element, and `null` otherwise. + */ + readonly lastElementChild: Element | null; + /** + * Returns the number of children that are elements. + */ + readonly childElementCount: number; + /** + * Prepends the list of nodes or strings before the first child node. + * Strings are converted into {@link Text} nodes. + * + * @param nodes - the array of nodes or strings + */ + prepend(...nodes: (Node | string)[]): void; + /** + * Appends the list of nodes or strings after the last child node. + * Strings are converted into {@link Text} nodes. + * + * @param nodes - the array of nodes or strings + */ + append(...nodes: (Node | string)[]): void; + /** + * Returns the first element that is a descendant of node that + * matches selectors. + * + * @param selectors - a selectors string + */ + querySelector(selectors: string): Element | null; + /** + * Returns all element descendants of node that match selectors. + * + * @param selectors - a selectors string + */ + querySelectorAll(selectors: string): NodeList; +} +/** + * Represents a mixin that extends child nodes that can have siblings + * including doctypes. This mixin is implemented by {@link Element}, + * {@link CharacterData} and {@link DocumentType}. + */ +export interface ChildNode { + /** + * Inserts nodes just before this node, while replacing strings in + * nodes with equivalent text nodes. + */ + before(...nodes: (Node | string)[]): void; + /** + * Inserts nodes just after this node, while replacing strings in + * nodes with equivalent text nodes. + */ + after(...nodes: (Node | string)[]): void; + /** + * Replaces nodes with this node, while replacing strings in + * nodes with equivalent text nodes. + */ + replaceWith(...nodes: (Node | string)[]): void; + /** + * Removes this node form its tree. + */ + remove(): void; +} +/** + * Represents a slot element of a shadow tree. + */ +export interface Slot extends Element { + _name: string; + _assignedNodes: Slotable[]; +} +/** + * Represents a mixin that allows nodes to become the contents of + * a element. This mixin is implemented by {@link Element} and + * {@link Text}. + */ +export interface Slotable { + /** + * Returns the element which this node is inserted in. + */ + readonly assignedSlot: HTMLSlotElement | null; + _name: string; + _assignedSlot: Slot | null; +} +/** + * Represents an attribute of an element node. + */ +export interface Attr extends Node { + /** + * Gets the namespace URI. + */ + readonly namespaceURI: string | null; + /** + * Gets the namespace prefix. + */ + readonly prefix: string | null; + /** + * Gets the local name. + */ + readonly localName: string; + /** + * If namespace prefix is not `null`, returns the concatenation of + * namespace prefix, `":"`, and local name. Otherwise it returns the + * local name. + */ + readonly name: string; + /** + * Gets or sets the attribute value. + */ + value: string; + /** + * Gets the owner element node. + */ + readonly ownerElement: Element | null; + /** + * Useless always returns true + */ + readonly specified: boolean; + _namespace: string | null; + _namespacePrefix: string | null; + _localName: string; + _value: string; + _element: Element | null; + readonly _qualifiedName: string; +} +/** + * Represents a CDATA node. + */ +export interface CDATASection extends Text { +} +/** + * Represents a comment node. + */ +export interface Comment extends CharacterData { +} +/** + * Represents an object providing methods which are not dependent on + * any particular document + */ +export interface DOMImplementation { + createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; + /** + * Creates and returns an {@link XMLDocument}. + * + * @param namespace - the namespace of the document element + * @param qualifiedName - the qualified name of the document element + * @param doctype - a {@link DocType} to assign to this document + */ + createDocument(namespace: string | null, qualifiedName: string, doctype?: DocumentType | null): XMLDocument; + /** + * Creates and returns a HTML document. + * + * @param title - document title + */ + createHTMLDocument(title?: string): Document; + /** + * Obsolete, always returns true. + */ + hasFeature(): boolean; + _ID: string; + _associatedDocument: Document; +} +/** + * Represents a token set. + */ +export interface DOMTokenList extends Iterable { + /** + * Returns the number of tokens. + */ + readonly length: number; + /** + * Returns the token at the given index. + * + * @param index - the index to of the token + */ + item(index: number): string | null; + /** + * Returns true if the set contains the given token. + * + * @param tokens - the token to check + */ + contains(token: string): boolean; + /** + * Adds the given tokens to the set. + * + * @param tokens - the list of tokens to add + */ + add(...tokens: string[]): void; + /** + * Removes the given tokens from the set. + * + * @param tokens - the list of tokens to remove + */ + remove(...tokens: string[]): void; + /** + * Removes a given token from the set and returns `false` if it exists, + * otherwise adds the token and returns `true`. + * + * @param token - the token to toggle + * @param force - if `false` the token will only be removed but not + * added again otherwise if `true` the token will only be added but + * not removed again. + * + * @returns `false` if the token is not in the list after the call, + * or `true` if the token is in the list after the call. + */ + toggle(token: string, force?: boolean | undefined): boolean; + /** + * Replaces the given token with a new token. + * + * @param token - the token to replace + * @param newToken - the new token + * + * @returns `true` if `token` was replaced with `newToken`, + * and `false` otherwise. + */ + replace(token: string, newToken: string): boolean; + /** + * Determines if a given token is in the associated attribute's + * supported tokens + * + * @param token - the token to check + */ + supports(token: string): boolean; + /** + * Gets the value of the token list as a string, or sets the token + * list to the given value. + */ + value: string; + _tokenSet: Set; + _element: Element; + _attribute: Attr; +} +/** + * Represents a collection of attributes. + */ +export interface NamedNodeMap { + /** + * Returns the number of attribute in the collection. + */ + readonly length: number; + /** + * Returns the attribute with index `index` from the collection. + * + * @param index - the zero-based index of the attribute to return + */ + item(index: number): Attr | null; + /** + * Returns the attribute with the given `qualifiedName`. + * + * @param qualifiedName - qualified name to search for + */ + getNamedItem(qualifiedName: string): Attr | null; + /** + * Returns the attribute with the given `namespace` and + * `qualifiedName`. + * + * @param namespace - namespace to search for + * @param localName - local name to search for + */ + getNamedItemNS(namespace: string | null, localName: string): Attr | null; + /** + * Sets the attribute given with `attr`. + * + * @param attr - attribute to set + */ + setNamedItem(attr: Attr): Attr | null; + /** + * Sets the attribute given with `attr`. + * + * @param attr - attribute to set + */ + setNamedItemNS(attr: Attr): Attr | null; + /** + * Removes the attribute with the given `qualifiedName`. + * + * @param qualifiedName - qualified name to search for + */ + removeNamedItem(qualifiedName: string): Attr; + /** + * Removes the attribute with the given `namespace` and + * `qualifiedName`. + * + * @param namespace - namespace to search for + * @param localName - local name to search for + */ + removeNamedItemNS(namespace: string | null, localName: string): Attr; + /** + * Returns the attribute with index `index` from the collection. Returns + * `undefined` is index is out of bounds. + */ + [index: number]: Attr; + /** + * Iterates over all attribute in the collection. + */ + [Symbol.iterator](): IterableIterator; + _element: Element; + _asArray(): Array; +} +/** + * Represents a node filter. + */ +export interface NodeFilter { + FILTER_ACCEPT: number; + FILTER_REJECT: number; + FILTER_SKIP: number; + SHOW_ALL: number; + SHOW_ELEMENT: number; + SHOW_ATTRIBUTE: number; + SHOW_TEXT: number; + SHOW_CDATA_SECTION: number; + SHOW_ENTITY_REFERENCE: number; + SHOW_ENTITY: number; + SHOW_PROCESSING_INSTRUCTION: number; + SHOW_COMMENT: number; + SHOW_DOCUMENT: number; + SHOW_DOCUMENT_TYPE: number; + SHOW_DOCUMENT_FRAGMENT: number; + SHOW_NOTATION: number; + /** + * Callback function. + */ + acceptNode(node: Node): FilterResult; +} +/** + * Represents a collection of nodes. + */ +export interface Collection { + _live: boolean; + _root: Node; + _filter: ((element: Element) => any) | null; +} +/** + * Represents an ordered list of nodes. + */ +export interface NodeList extends Collection, Iterable { + /** + * Returns the number of nodes in the list. + */ + readonly length: number; + /** + * Returns an iterator for node indices. + */ + keys(): Iterable; + /** + * Returns an iterator for nodes. + */ + values(): Iterable; + /** + * Returns an iterator for indices and nodes. + */ + entries(): Iterable<[number, Node]>; + /** + * Returns the node with index `index` from the collection. + * + * @param index - the zero-based index of the node to return + */ + item(index: number): Node | null; + /** + * Returns the node at the given index from the collection. Returns `undefined` + * if the index is out-of-bounds. + */ + [index: number]: Node | undefined; + /** + * Returns an iterator for the node list. + */ + [Symbol.iterator](): Iterator; + /** + * Calls the callback function for each node in the list. The callback + * receives arguments as follows: + * - the current node + * - index of the current node + * - the node list object + * + * @param callback - function to execute for each node + * @param thisArg - value to use as `this` when executing callback + */ + forEach(callback: (node: Node, index: number, list: NodeList) => any, thisArg?: any): void; + /** + * Used to keep track of child node count. This is a non-standard property. + */ + _length: number; +} +/** + * Represents a mixin that extends child nodes that can have siblings + * other than doctypes. This mixin is implemented by {@link Element} and + * {@link CharacterData}. + */ +export interface NonDocumentTypeChildNode { + /** + * Returns the previous sibling that is an element node. + */ + readonly previousElementSibling: Element | null; + /** + * Returns the next sibling that is an element node. + */ + readonly nextElementSibling: Element | null; +} +/** + * Represents a processing instruction node. + */ +export interface ProcessingInstruction extends CharacterData { + /** + * Gets the target of the node. + */ + readonly target: string; + _target: string; +} +/** + * Represents an object which can be used to traverse through the nodes + * of a subtree. + */ +export interface Traverser { + /** + * Gets the root node of the subtree. + */ + readonly root: Node; + /** + * Gets the node types to match. + */ + readonly whatToShow: WhatToShow; + /** + * Gets the filter used to selected the nodes. + */ + readonly filter: NodeFilter | null; + _activeFlag: boolean; + _root: Node; + _whatToShow: WhatToShow; + _filter: NodeFilter | null; +} +/** + * Represents an object which can be used to iterate through the nodes + * of a subtree. + */ +export interface NodeIterator extends Traverser { + /** + * Gets the node current node of the. + */ + readonly referenceNode: Node; + /** + * Gets a flag that indicates whether the iterator is anchored before + * or after the reference node. If is `true`, the iterator is anchored + * before the node, otherwise it is anchored after the node. + */ + readonly pointerBeforeReferenceNode: boolean; + /** + * Returns the next node in the subtree, or `null` if there are none. + */ + nextNode(): Node | null; + /** + * Returns the previous node in the subtree, or `null` if there + * are none. + */ + previousNode(): Node | null; + /** + * Removes a range object from its owner document. + * + * _Note:_ According to the specification, this method is a no-op. + * However, since JavaScript lacks weak references, there is no reliable + * method of detecting out-of-scope variables. So, it is recommended to + * manually `detach` range objects after using them. + */ + detach(): void; + _iteratorCollection: Collection; + _reference: Node; + _pointerBeforeReference: boolean; +} +/** + * Represents the nodes of a subtree and a position within them. + */ +export interface TreeWalker extends Traverser { + /** + * Gets or sets the node to which the iterator is pointing at. + */ + currentNode: Node; + /** + * Moves the iterator to the first parent node of current node, and + * returns it. Returns `null` if no such node exists. + */ + parentNode(): Node | null; + /** + * Moves the iterator to the first child node of current node, and + * returns it. Returns `null` if no such node exists. + */ + firstChild(): Node | null; + /** + * Moves the iterator to the last child node of current node, and + * returns it. Returns `null` if no such node exists. + */ + lastChild(): Node | null; + /** + * Moves the iterator to the next sibling of current node, and + * returns it. Returns `null` if no such node exists. + */ + nextSibling(): Node | null; + /** + * Moves the iterator to the previous sibling of current node, and + * returns it. Returns `null` if no such node exists. + */ + previousSibling(): Node | null; + /** + * Returns the next node in the subtree, or `null` if there are none. + */ + nextNode(): Node | null; + /** + * Returns the previous node in the subtree, or `null` if there + * are none. + */ + previousNode(): Node | null; + _current: Node; +} +/** + * Represents an abstract range with a start and end boundary point. + */ +export interface AbstractRange { + /** + * Returns the start node of the range. + */ + readonly startContainer: Node; + /** + * Returns the start offset of the range. + */ + readonly startOffset: number; + /** + * Returns the end node of the range. + */ + readonly endContainer: Node; + /** + * Returns the end offest of the range. + */ + readonly endOffset: number; + /** + * Returns `true` if the range starts and ends at the same point. + */ + readonly collapsed: boolean; + _start: BoundaryPoint; + _end: BoundaryPoint; + readonly _startNode: Node; + readonly _startOffset: number; + readonly _endNode: Node; + readonly _endOffset: number; + readonly _collapsed: boolean; +} +/** + * Represents a static range. + */ +export interface StaticRange extends AbstractRange { +} +/** + * Represents a live range. + */ +export interface Range extends AbstractRange { + START_TO_START: number; + START_TO_END: number; + END_TO_END: number; + END_TO_START: number; + /** + * Returns the node, furthest away from the document, that is an + * ancestor of both range's start node and end node. + */ + readonly commonAncestorContainer: Node; + /** + * Sets the start of the range to the given boundary point. + * + * @param node - node of the boundary point + * @param offset - offset of the boundary point along node's content + */ + setStart(node: Node, offset: number): void; + /** + * Sets the end of the range to the given boundary point. + * + * @param node - node of the boundary point + * @param offset - offset of the boundary point along node's content + */ + setEnd(node: Node, offset: number): void; + /** + * Sets the start of the range to just before the given node. + * + * @param node - node of the boundary point + */ + setStartBefore(node: Node): void; + /** + * Sets the start of the range to just after the given node. + * + * @param node - node of the boundary point + */ + setStartAfter(node: Node): void; + /** + * Sets the end of the range to just before the given node. + * + * @param node - node of the boundary point + */ + setEndBefore(node: Node): void; + /** + * Sets the end of the range to just after the given node. + * + * @param node - node of the boundary point + */ + setEndAfter(node: Node): void; + /** + * Collapses the range. + * + * @param toStart - `true` to collapse to start node, otherwise + * `false` to collapse to the end node. + */ + collapse(toStart?: boolean): void; + /** + * Sets the range to contain the given node. + * + * @param node - the range to select + */ + selectNode(node: Node): void; + /** + * Sets the range to contain the given node's contens. + * + * @param node - the range to select + */ + selectNodeContents(node: Node): void; + /** + * Compares the boundary points of this range with another one. + * + * @param how - comparison method: + * * `EndToEnd` - compares the end boundary-point of `sourceRange` to the end + * boundary-point of this range. + * * `EndToStart` - compares the end boundary-point of `sourceRange` to the + * start boundary-point of this range. + * * `StartToEnd` - compares the start boundary-point of `sourceRange` to the + * end boundary-point of this range. + * * `StartToStart` - compares the start boundary-point of `sourceRange` to + * the start boundary-point of this range. + * @param sourceRange - the range to compare to + * + * @returns a number depending on boundaries of ranges relative to each other: + * * `-1` if the corresponding boundary point of this is range comes before + * that of `sourceRange` + * * `1` if the corresponding boundary point of this is range comes after + * that of `sourceRange` + * * `0` if corresponding boundary points of both ranges are equal + */ + compareBoundaryPoints(how: HowToCompare, sourceRange: Range): number; + /** + * Removes the contents of the range from the tree. + */ + deleteContents(): void; + /** + * Moves the contents of the range to a document fragment. + */ + extractContents(): DocumentFragment; + /** + * Copies the contents of the range to a document fragment. + */ + cloneContents(): DocumentFragment; + /** + * Inserts a node at the start boundary point. + * + * @param node - the node to insert + */ + insertNode(node: Node): void; + /** + * Moves content of the Range into a new node, placing the new node + * at the start of the range. + * + * @param newParent - a node to receive range's content + */ + surroundContents(newParent: Node): void; + /** + * Creates a new range with identical boundary points. + */ + cloneRange(): Range; + /** + * Unused method. Kept for compatibility. + */ + detach(): void; + /** + * Determines whether the range contains the given boundary point. + * + * @param node - the node of the boundary point + * @param offset - the offset of the boundary point + */ + isPointInRange(node: Node, offset: number): boolean; + /** + * Returns `-1`, `0`, or `1` depending on whether `node` is + * before, the same as, or after the range. + * + * @param node - the node to compare + * @param offset - an offset within node + */ + comparePoint(node: Node, offset: number): number; + /** + * Determines whether the given node intersects the range. + * + * @param node - the node to check + */ + intersectsNode(node: Node): boolean; +} +/** +* Represents a html element node. +*/ +export interface HTMLElement extends Element { +} +/** + * Represents a `` element. + */ +export interface HTMLSlotElement extends HTMLElement { +} +/** + * Defines the position of a boundary point relative to another. + */ +export declare enum BoundaryPosition { + Before = 0, + Equal = 1, + After = 2 +} +/** + * Defines the event phase. + */ +export declare enum EventPhase { + None = 0, + Capturing = 1, + AtTarget = 2, + Bubbling = 3 +} +/** + * Defines the type of a node object. + */ +export declare enum NodeType { + Element = 1, + Attribute = 2, + Text = 3, + CData = 4, + EntityReference = 5, + Entity = 6, + ProcessingInstruction = 7, + Comment = 8, + Document = 9, + DocumentType = 10, + DocumentFragment = 11, + Notation = 12 +} +/** + * Defines the position of a node in the document relative to another + * node. + */ +export declare enum Position { + Disconnected = 1, + Preceding = 2, + Following = 4, + Contains = 8, + ContainedBy = 16, + ImplementationSpecific = 32 +} +/** + * Defines the return value of a filter callback. + */ +export declare enum FilterResult { + Accept = 1, + Reject = 2, + Skip = 3 +} +/** + * Defines what to show in node filter. + */ +export declare enum WhatToShow { + All = 4294967295, + Element = 1, + Attribute = 2, + Text = 4, + CDataSection = 8, + EntityReference = 16, + Entity = 32, + ProcessingInstruction = 64, + Comment = 128, + Document = 256, + DocumentType = 512, + DocumentFragment = 1024, + Notation = 2048 +} +/** + * Defines how boundary points are compared. + */ +export declare enum HowToCompare { + StartToStart = 0, + StartToEnd = 1, + EndToEnd = 2, + EndToStart = 3 +} +/** + * Represents settings for the getRootNode() function. + */ +export interface GetRootNodeOptions { + composed?: boolean; +} +/** + * Represents event initialization options. + */ +export interface EventInit { + bubbles?: boolean; + cancelable?: boolean; + composed?: boolean; +} +/** + * Represents custom event initialization options. + */ +export interface CustomEventInit extends EventInit { + detail?: any; +} +/** + * Defines event listener options. + */ +export interface EventListenerOptions { + capture?: boolean; +} +/** + * Defines options for the `addEventListener` function. + */ +export interface AddEventListenerOptions extends EventListenerOptions { + passive?: boolean; + once?: boolean; +} +/** + * Defines the criteria for the mutations to observe. + */ +export interface MutationObserverInit { + childList?: boolean; + attributes?: boolean; + characterData?: boolean; + subtree?: boolean; + attributeOldValue?: boolean; + characterDataOldValue?: boolean; + attributeFilter?: string[]; +} +/** + * Defines an entry in the event listeners list. + */ +export declare type EventListenerEntry = { + type: string; + callback: EventListener; + capture: boolean; + passive: boolean; + once: boolean; + removed: boolean; +}; +/** + * Defines a non-null event handler. + */ +export declare type EventHandlerNonNull = ((event: Event) => any); +/** + * Defines an event handler. + */ +export declare type EventHandler = EventHandlerNonNull | null; +/** + * Defines a struct containing an event handler. + */ +export declare type EventHandlerEntry = { + value: EventHandler; + listener: EventListenerEntry | null; +}; +/** + * Defines static range constructor parameters. + */ +export declare type StaticRangeInit = { + startContainer: Node; + startOffset: number; + endContainer: Node; + endOffset: number; +}; +/** + * Defines a boundary point which is a tuple consisting of a node and an offset + * into the node's contents. + */ +export declare type BoundaryPoint = [Node, number]; +/** + * Defines a callback function which is invoked after nodes registered with the + * observe() method, are mutated. + * + * @param mutations - a list of `MutationRecord` objects + * @param observer - the constructed `MutationObserver` object + */ +export declare type MutationCallback = (mutations: MutationRecord[], observer: MutationObserver) => void; +/** + * Represents a registered observer associated with a node. + */ +export declare type RegisteredObserver = { + observer: MutationObserver; + options: MutationObserverInit; +}; +/** + * Represents a transient registered observer associated with a node. + * Transient registered observers are used to track mutations within a given + * node's descendants after node has been removed so they do not get lost when + * subtree is set to true on node's parent. + */ +export declare type TransientRegisteredObserver = RegisteredObserver & { + source: RegisteredObserver; +}; +/** + * Defines the mode of a shadow root. + */ +export declare type ShadowRootMode = 'open' | 'closed'; +/** + * Represents a potential event target. + */ +export declare type PotentialEventTarget = EventTarget | null; +/** + * Represents an object on the event path. + */ +export declare type EventPathItem = { + invocationTarget: EventTarget; + invocationTargetInShadowTree: boolean; + shadowAdjustedTarget: PotentialEventTarget; + relatedTarget: PotentialEventTarget; + touchTargetList: PotentialEventTarget[]; + rootOfClosedTree: boolean; + slotInClosedTree: boolean; +}; +/** + * Represents a document origin. + * `null` represents an opaque origin. + */ +export declare type Origin = null | [string, // scheme +// scheme +string | number | number[], // host +// host +null | number, // port +// port +null | string]; +/** + * Represents a `` element. + */ +export interface HTMLSlotElement { + name: string; + assignedNodes(options?: any): Node[]; + assignedElements(options?: any): Element[]; +} +/** + * Represents a `UIEvent`. + */ +export interface UIEvent extends Event { + readonly view?: Window; + readonly detail: number; +} +/** + * Represents a `MouseEvent`. + */ +export interface MouseEvent extends UIEvent { + readonly screenX: number; + readonly screenY: number; + readonly clientX: number; + readonly clientY: number; + readonly ctrlKey: boolean; + readonly shiftKey: boolean; + readonly altKey: boolean; + readonly metaKey: boolean; + readonly button: number; + readonly buttons: number; + readonly relatedTarget?: EventTarget; + getModifierState(keyArg: string): boolean; +} +/** + * Represents a custom element definition. + */ +export declare type CustomElementDefinition = { + name: string; + localName: string; + constructor: (new (...args: any[]) => Element); + observedAttributes: string[]; + lifecycleCallbacks: { + "connectedCallback": ((args: any[]) => any) | null; + "disconnectedCallback": ((args: any[]) => any) | null; + "adoptedCallback": ((args: any) => any[]) | null; + "attributeChangedCallback": ((args: any[]) => any) | null; + "formAssociatedCallback": ((args: any[]) => any) | null; + "formDisabledCallback": ((args: any[]) => any) | null; + "formResetCallback": ((args: any[]) => any) | null; + "formStateRestoreCallback": ((args: any[]) => any) | null; + }; + constructionStack: (Element | boolean)[]; + formAssociated: boolean; + disableInternals: boolean; + disableShadow: boolean; +}; +/** + * Defines an attribute change step. + */ +export declare type AttributeChangeStep = ((element: Element, localName: string, oldValue: string | null, value: string | null, namespace: string | null) => any); diff --git a/node_modules/@oozcitak/dom/lib/dom/interfaces.js b/node_modules/@oozcitak/dom/lib/dom/interfaces.js new file mode 100644 index 0000000..2faf599 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/interfaces.js @@ -0,0 +1,91 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Defines the position of a boundary point relative to another. + */ +var BoundaryPosition; +(function (BoundaryPosition) { + BoundaryPosition[BoundaryPosition["Before"] = 0] = "Before"; + BoundaryPosition[BoundaryPosition["Equal"] = 1] = "Equal"; + BoundaryPosition[BoundaryPosition["After"] = 2] = "After"; +})(BoundaryPosition = exports.BoundaryPosition || (exports.BoundaryPosition = {})); +/** + * Defines the event phase. + */ +var EventPhase; +(function (EventPhase) { + EventPhase[EventPhase["None"] = 0] = "None"; + EventPhase[EventPhase["Capturing"] = 1] = "Capturing"; + EventPhase[EventPhase["AtTarget"] = 2] = "AtTarget"; + EventPhase[EventPhase["Bubbling"] = 3] = "Bubbling"; +})(EventPhase = exports.EventPhase || (exports.EventPhase = {})); +/** + * Defines the type of a node object. + */ +var NodeType; +(function (NodeType) { + NodeType[NodeType["Element"] = 1] = "Element"; + NodeType[NodeType["Attribute"] = 2] = "Attribute"; + NodeType[NodeType["Text"] = 3] = "Text"; + NodeType[NodeType["CData"] = 4] = "CData"; + NodeType[NodeType["EntityReference"] = 5] = "EntityReference"; + NodeType[NodeType["Entity"] = 6] = "Entity"; + NodeType[NodeType["ProcessingInstruction"] = 7] = "ProcessingInstruction"; + NodeType[NodeType["Comment"] = 8] = "Comment"; + NodeType[NodeType["Document"] = 9] = "Document"; + NodeType[NodeType["DocumentType"] = 10] = "DocumentType"; + NodeType[NodeType["DocumentFragment"] = 11] = "DocumentFragment"; + NodeType[NodeType["Notation"] = 12] = "Notation"; // historical +})(NodeType = exports.NodeType || (exports.NodeType = {})); +/** + * Defines the position of a node in the document relative to another + * node. + */ +var Position; +(function (Position) { + Position[Position["Disconnected"] = 1] = "Disconnected"; + Position[Position["Preceding"] = 2] = "Preceding"; + Position[Position["Following"] = 4] = "Following"; + Position[Position["Contains"] = 8] = "Contains"; + Position[Position["ContainedBy"] = 16] = "ContainedBy"; + Position[Position["ImplementationSpecific"] = 32] = "ImplementationSpecific"; +})(Position = exports.Position || (exports.Position = {})); +/** + * Defines the return value of a filter callback. + */ +var FilterResult; +(function (FilterResult) { + FilterResult[FilterResult["Accept"] = 1] = "Accept"; + FilterResult[FilterResult["Reject"] = 2] = "Reject"; + FilterResult[FilterResult["Skip"] = 3] = "Skip"; +})(FilterResult = exports.FilterResult || (exports.FilterResult = {})); +/** + * Defines what to show in node filter. + */ +var WhatToShow; +(function (WhatToShow) { + WhatToShow[WhatToShow["All"] = 4294967295] = "All"; + WhatToShow[WhatToShow["Element"] = 1] = "Element"; + WhatToShow[WhatToShow["Attribute"] = 2] = "Attribute"; + WhatToShow[WhatToShow["Text"] = 4] = "Text"; + WhatToShow[WhatToShow["CDataSection"] = 8] = "CDataSection"; + WhatToShow[WhatToShow["EntityReference"] = 16] = "EntityReference"; + WhatToShow[WhatToShow["Entity"] = 32] = "Entity"; + WhatToShow[WhatToShow["ProcessingInstruction"] = 64] = "ProcessingInstruction"; + WhatToShow[WhatToShow["Comment"] = 128] = "Comment"; + WhatToShow[WhatToShow["Document"] = 256] = "Document"; + WhatToShow[WhatToShow["DocumentType"] = 512] = "DocumentType"; + WhatToShow[WhatToShow["DocumentFragment"] = 1024] = "DocumentFragment"; + WhatToShow[WhatToShow["Notation"] = 2048] = "Notation"; +})(WhatToShow = exports.WhatToShow || (exports.WhatToShow = {})); +/** + * Defines how boundary points are compared. + */ +var HowToCompare; +(function (HowToCompare) { + HowToCompare[HowToCompare["StartToStart"] = 0] = "StartToStart"; + HowToCompare[HowToCompare["StartToEnd"] = 1] = "StartToEnd"; + HowToCompare[HowToCompare["EndToEnd"] = 2] = "EndToEnd"; + HowToCompare[HowToCompare["EndToStart"] = 3] = "EndToStart"; +})(HowToCompare = exports.HowToCompare || (exports.HowToCompare = {})); +//# sourceMappingURL=interfaces.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/dom/interfaces.js.map b/node_modules/@oozcitak/dom/lib/dom/interfaces.js.map new file mode 100644 index 0000000..c2b17b0 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/dom/interfaces.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/dom/interfaces.ts"],"names":[],"mappings":";;AA6uEA;;GAEG;AACH,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,2DAAM,CAAA;IACN,yDAAK,CAAA;IACL,yDAAK,CAAA;AACP,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B;AAED;;GA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W,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAcrB;AAED;;GAEG;AACH,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,+DAAgB,CAAA;IAChB,2DAAc,CAAA;IACd,uDAAY,CAAA;IACZ,2DAAc,CAAA;AAChB,CAAC,EALW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAKvB"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/index.d.ts b/node_modules/@oozcitak/dom/lib/index.d.ts new file mode 100644 index 0000000..bf2f5f7 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/index.d.ts @@ -0,0 +1,3 @@ +export { DOMImplementation } from "./dom"; +export { DOMParser } from "./parser"; +export { XMLSerializer } from "./serializer"; diff --git a/node_modules/@oozcitak/dom/lib/index.js b/node_modules/@oozcitak/dom/lib/index.js new file mode 100644 index 0000000..87d3b00 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/index.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var dom_1 = require("./dom"); +dom_1.dom.setFeatures(true); +var dom_2 = require("./dom"); +exports.DOMImplementation = dom_2.DOMImplementation; +var parser_1 = require("./parser"); +exports.DOMParser = parser_1.DOMParser; +var serializer_1 = require("./serializer"); +exports.XMLSerializer = serializer_1.XMLSerializer; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/index.js.map b/node_modules/@oozcitak/dom/lib/index.js.map new file mode 100644 index 0000000..d3844e3 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,6BAA2B;AAC3B,SAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;AAErB,6BAAyC;AAAhC,kCAAA,iBAAiB,CAAA;AAC1B,mCAAoC;AAA3B,6BAAA,SAAS,CAAA;AAClB,2CAA4C;AAAnC,qCAAA,aAAa,CAAA"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/parser/DOMParserImpl.d.ts b/node_modules/@oozcitak/dom/lib/parser/DOMParserImpl.d.ts new file mode 100644 index 0000000..ebdae73 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/parser/DOMParserImpl.d.ts @@ -0,0 +1,11 @@ +import { DOMParser, MimeType } from "./interfaces"; +import { Document } from "../dom/interfaces"; +/** + * Represents a parser for XML and HTML content. + * + * See: https://w3c.github.io/DOM-Parsing/#the-domparser-interface + */ +export declare class DOMParserImpl implements DOMParser { + /** @inheritdoc */ + parseFromString(source: string, mimeType: MimeType): Document; +} diff --git a/node_modules/@oozcitak/dom/lib/parser/DOMParserImpl.js b/node_modules/@oozcitak/dom/lib/parser/DOMParserImpl.js new file mode 100644 index 0000000..641ac57 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/parser/DOMParserImpl.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var algorithm_1 = require("../algorithm"); +var XMLParserImpl_1 = require("./XMLParserImpl"); +/** + * Represents a parser for XML and HTML content. + * + * See: https://w3c.github.io/DOM-Parsing/#the-domparser-interface + */ +var DOMParserImpl = /** @class */ (function () { + function DOMParserImpl() { + } + /** @inheritdoc */ + DOMParserImpl.prototype.parseFromString = function (source, mimeType) { + if (mimeType === "text/html") + throw new Error('HTML parser not implemented.'); + try { + var parser = new XMLParserImpl_1.XMLParserImpl(); + var doc = parser.parse(source); + doc._contentType = mimeType; + return doc; + } + catch (e) { + var errorNS = "http://www.mozilla.org/newlayout/xml/parsererror.xml"; + var doc = algorithm_1.create_xmlDocument(); + var root = doc.createElementNS(errorNS, "parsererror"); + var ele = doc.createElementNS(errorNS, "error"); + ele.setAttribute("message", e.message); + root.appendChild(ele); + doc.appendChild(root); + return doc; + } + }; + return DOMParserImpl; +}()); +exports.DOMParserImpl = DOMParserImpl; +//# sourceMappingURL=DOMParserImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/parser/DOMParserImpl.js.map b/node_modules/@oozcitak/dom/lib/parser/DOMParserImpl.js.map new file mode 100644 index 0000000..36192a8 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/parser/DOMParserImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DOMParserImpl.js","sourceRoot":"","sources":["../../src/parser/DOMParserImpl.ts"],"names":[],"mappings":";;AAEA,0CAAiD;AACjD,iDAA+C;AAE/C;;;;GAIG;AACH;IAAA;IAuBA,CAAC;IArBC,kBAAkB;IAClB,uCAAe,GAAf,UAAgB,MAAc,EAAE,QAAkB;QAChD,IAAI,QAAQ,KAAK,WAAW;YAC1B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;QAEjD,IAAI;YACF,IAAM,MAAM,GAAG,IAAI,6BAAa,EAAE,CAAA;YAClC,IAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;YAChC,GAAG,CAAC,YAAY,GAAG,QAAQ,CAAA;YAC3B,OAAO,GAAG,CAAA;SACX;QAAC,OAAO,CAAC,EAAE;YACV,IAAM,OAAO,GAAG,sDAAsD,CAAA;YACtE,IAAM,GAAG,GAAG,8BAAkB,EAAE,CAAA;YAChC,IAAM,IAAI,GAAG,GAAG,CAAC,eAAe,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;YACxD,IAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YACjD,GAAG,CAAC,YAAY,CAAC,SAAS,EAAG,CAAW,CAAC,OAAO,CAAC,CAAA;YACjD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;YACrB,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;YACrB,OAAO,GAAG,CAAA;SACX;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AAvBD,IAuBC;AAvBY,sCAAa"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.d.ts b/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.d.ts new file mode 100644 index 0000000..ea110a7 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.d.ts @@ -0,0 +1,14 @@ +import { Document } from "../dom/interfaces"; +/** + * Represents a parser for XML content. + * + * See: https://html.spec.whatwg.org/#xml-parser + */ +export declare class XMLParserImpl { + /** + * Parses XML content. + * + * @param source - a string containing XML content + */ + parse(source: string): Document; +} diff --git a/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.js b/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.js new file mode 100644 index 0000000..44d1fa1 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.js @@ -0,0 +1,220 @@ +"use strict"; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var XMLStringLexer_1 = require("./XMLStringLexer"); +var interfaces_1 = require("./interfaces"); +var infra_1 = require("@oozcitak/infra"); +var algorithm_1 = require("../algorithm"); +var LocalNameSet_1 = require("../serializer/LocalNameSet"); +/** + * Represents a parser for XML content. + * + * See: https://html.spec.whatwg.org/#xml-parser + */ +var XMLParserImpl = /** @class */ (function () { + function XMLParserImpl() { + } + /** + * Parses XML content. + * + * @param source - a string containing XML content + */ + XMLParserImpl.prototype.parse = function (source) { + var e_1, _a, e_2, _b; + var lexer = new XMLStringLexer_1.XMLStringLexer(source, { skipWhitespaceOnlyText: true }); + var doc = algorithm_1.create_document(); + var context = doc; + var token = lexer.nextToken(); + while (token.type !== interfaces_1.TokenType.EOF) { + switch (token.type) { + case interfaces_1.TokenType.Declaration: + var declaration = token; + if (declaration.version !== "1.0") { + throw new Error("Invalid xml version: " + declaration.version); + } + break; + case interfaces_1.TokenType.DocType: + var doctype = token; + if (!algorithm_1.xml_isPubidChar(doctype.pubId)) { + throw new Error("DocType public identifier does not match PubidChar construct."); + } + if (!algorithm_1.xml_isLegalChar(doctype.sysId) || + (doctype.sysId.indexOf('"') !== -1 && doctype.sysId.indexOf("'") !== -1)) { + throw new Error("DocType system identifier contains invalid characters."); + } + context.appendChild(doc.implementation.createDocumentType(doctype.name, doctype.pubId, doctype.sysId)); + break; + case interfaces_1.TokenType.CDATA: + var cdata = token; + if (!algorithm_1.xml_isLegalChar(cdata.data) || + cdata.data.indexOf("]]>") !== -1) { + throw new Error("CDATA contains invalid characters."); + } + context.appendChild(doc.createCDATASection(cdata.data)); + break; + case interfaces_1.TokenType.Comment: + var comment = token; + if (!algorithm_1.xml_isLegalChar(comment.data) || + comment.data.indexOf("--") !== -1 || comment.data.endsWith("-")) { + throw new Error("Comment data contains invalid characters."); + } + context.appendChild(doc.createComment(comment.data)); + break; + case interfaces_1.TokenType.PI: + var pi = token; + if (pi.target.indexOf(":") !== -1 || (/^xml$/i).test(pi.target)) { + throw new Error("Processing instruction target contains invalid characters."); + } + if (!algorithm_1.xml_isLegalChar(pi.data) || pi.data.indexOf("?>") !== -1) { + throw new Error("Processing instruction data contains invalid characters."); + } + context.appendChild(doc.createProcessingInstruction(pi.target, pi.data)); + break; + case interfaces_1.TokenType.Text: + var text = token; + if (!algorithm_1.xml_isLegalChar(text.data)) { + throw new Error("Text data contains invalid characters."); + } + context.appendChild(doc.createTextNode(text.data)); + break; + case interfaces_1.TokenType.Element: + var element = token; + // inherit namespace from parent + var _c = __read(algorithm_1.namespace_extractQName(element.name), 2), prefix = _c[0], localName = _c[1]; + if (localName.indexOf(":") !== -1 || !algorithm_1.xml_isName(localName)) { + throw new Error("Node local name contains invalid characters."); + } + if (prefix === "xmlns") { + throw new Error("An element cannot have the 'xmlns' prefix."); + } + var namespace = context.lookupNamespaceURI(prefix); + // override namespace if there is a namespace declaration + // attribute + // also lookup namespace declaration attributes + var nsDeclarations = {}; + try { + for (var _d = (e_1 = void 0, __values(element.attributes)), _e = _d.next(); !_e.done; _e = _d.next()) { + var _f = __read(_e.value, 2), attName = _f[0], attValue = _f[1]; + if (attName === "xmlns") { + namespace = attValue; + } + else { + var _g = __read(algorithm_1.namespace_extractQName(attName), 2), attPrefix = _g[0], attLocalName = _g[1]; + if (attPrefix === "xmlns") { + if (attLocalName === prefix) { + namespace = attValue; + } + nsDeclarations[attLocalName] = attValue; + } + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_e && !_e.done && (_a = _d.return)) _a.call(_d); + } + finally { if (e_1) throw e_1.error; } + } + // create the DOM element node + var elementNode = (namespace !== null ? + doc.createElementNS(namespace, element.name) : + doc.createElement(element.name)); + context.appendChild(elementNode); + // assign attributes + var localNameSet = new LocalNameSet_1.LocalNameSet(); + try { + for (var _h = (e_2 = void 0, __values(element.attributes)), _j = _h.next(); !_j.done; _j = _h.next()) { + var _k = __read(_j.value, 2), attName = _k[0], attValue = _k[1]; + var _l = __read(algorithm_1.namespace_extractQName(attName), 2), attPrefix = _l[0], attLocalName = _l[1]; + var attNamespace = null; + if (attPrefix === "xmlns" || (attPrefix === null && attLocalName === "xmlns")) { + // namespace declaration attribute + attNamespace = infra_1.namespace.XMLNS; + } + else { + attNamespace = elementNode.lookupNamespaceURI(attPrefix); + if (attNamespace !== null && elementNode.isDefaultNamespace(attNamespace)) { + attNamespace = null; + } + else if (attNamespace === null && attPrefix !== null) { + attNamespace = nsDeclarations[attPrefix] || null; + } + } + if (localNameSet.has(attNamespace, attLocalName)) { + throw new Error("Element contains duplicate attributes."); + } + localNameSet.set(attNamespace, attLocalName); + if (attNamespace === infra_1.namespace.XMLNS) { + if (attValue === infra_1.namespace.XMLNS) { + throw new Error("XMLNS namespace is reserved."); + } + } + if (attLocalName.indexOf(":") !== -1 || !algorithm_1.xml_isName(attLocalName)) { + throw new Error("Attribute local name contains invalid characters."); + } + if (attPrefix === "xmlns" && attValue === "") { + throw new Error("Empty XML namespace is not allowed."); + } + if (attNamespace !== null) + elementNode.setAttributeNS(attNamespace, attName, attValue); + else + elementNode.setAttribute(attName, attValue); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_j && !_j.done && (_b = _h.return)) _b.call(_h); + } + finally { if (e_2) throw e_2.error; } + } + if (!element.selfClosing) { + context = elementNode; + } + break; + case interfaces_1.TokenType.ClosingTag: + var closingTag = token; + if (closingTag.name !== context.nodeName) { + throw new Error('Closing tag name does not match opening tag name.'); + } + /* istanbul ignore else */ + if (context._parent) { + context = context._parent; + } + break; + } + token = lexer.nextToken(); + } + return doc; + }; + return XMLParserImpl; +}()); +exports.XMLParserImpl = XMLParserImpl; +//# sourceMappingURL=XMLParserImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.js.map b/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.js.map new file mode 100644 index 0000000..1ca9b74 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"XMLParserImpl.js","sourceRoot":"","sources":["../../src/parser/XMLParserImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAiD;AACjD,2CAA0D;AAM1D,yCAA6D;AAC7D,0CAGqB;AACrB,2DAAyD;AAEzD;;;;GAIG;AACH;IAAA;IAsKA,CAAC;IApKC;;;;OAIG;IACH,6BAAK,G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O,EAAE;wBACnB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;qBAC1B;oBACD,MAAK;aACR;YAED,KAAK,GAAG,KAAK,CAAC,SAAS,EAAE,CAAA;SAC1B;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;IACH,oBAAC;AAAD,CAAC,AAtKD,IAsKC;AAtKY,sCAAa"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/parser/XMLStringLexer.d.ts b/node_modules/@oozcitak/dom/lib/parser/XMLStringLexer.d.ts new file mode 100644 index 0000000..256d77c --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/parser/XMLStringLexer.d.ts @@ -0,0 +1,159 @@ +import { XMLToken, XMLLexer, XMLLexerOptions } from "./interfaces"; +/** + * Represents a lexer for XML content in a string. + */ +export declare class XMLStringLexer implements XMLLexer { + private _str; + private _index; + private _length; + private _options; + err: { + line: number; + col: number; + index: number; + str: string; + }; + /** + * Initializes a new instance of `XMLStringLexer`. + * + * @param str - the string to tokenize and lex + * @param options - lexer options + */ + constructor(str: string, options?: Partial); + /** + * Returns the next token. + */ + nextToken(): XMLToken; + /** + * Branches from an opening bracket (`<`). + */ + private openBracket; + /** + * Produces an XML declaration token. + */ + private declaration; + /** + * Produces a doc type token. + */ + private doctype; + /** + * Produces a processing instruction token. + */ + private pi; + /** + * Produces a text token. + * + */ + private text; + /** + * Produces a comment token. + * + */ + private comment; + /** + * Produces a CDATA token. + * + */ + private cdata; + /** + * Produces an element token. + */ + private openTag; + /** + * Produces a closing tag token. + * + */ + private closeTag; + /** + * Reads an attribute name, value pair + */ + private attribute; + /** + * Reads a string between double or single quotes. + */ + private quotedString; + /** + * Determines if the current index is at or past the end of input string. + */ + private eof; + /** + * Skips the length of the given string if the string from current position + * starts with the given string. + * + * @param str - the string to match + */ + private skipIfStartsWith; + /** + * Seeks a number of character codes. + * + * @param count - number of characters to skip + */ + private seek; + /** + * Skips space characters. + */ + private skipSpace; + /** + * Takes a given number of characters. + * + * @param count - character count + */ + private take; + /** + * Takes characters until the next character matches `char`. + * + * @param char - a character to match + * @param space - whether a space character stops iteration + */ + private takeUntil; + /** + * Takes characters until the next character matches `char1` or `char1`. + * + * @param char1 - a character to match + * @param char2 - a character to match + * @param space - whether a space character stops iteration + */ + private takeUntil2; + /** + * Takes characters until the next characters matches `str`. + * + * @param str - a string to match + * @param space - whether a space character stops iteration + */ + private takeUntilStartsWith; + /** + * Skips characters until the next character matches `char`. + * + * @param char - a character to match + */ + private skipUntil; + /** + * Determines if the given token is entirely whitespace. + * + * @param token - the token to check + */ + private static isWhiteSpaceToken; + /** + * Determines if the given character is whitespace. + * + * @param char - the character to check + */ + private static isSpace; + /** + * Determines if the given character is a quote character. + * + * @param char - the character to check + */ + private static isQuote; + /** + * Throws a parser error and records the line and column numbers in the parsed + * string. + * + * @param msg - error message + */ + private throwError; + /** + * Returns an iterator for the lexer. + */ + [Symbol.iterator](): Iterator; +} diff --git a/node_modules/@oozcitak/dom/lib/parser/XMLStringLexer.js b/node_modules/@oozcitak/dom/lib/parser/XMLStringLexer.js new file mode 100644 index 0000000..73c66cd --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/parser/XMLStringLexer.js @@ -0,0 +1,512 @@ +"use strict"; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("./interfaces"); +/** + * Represents a lexer for XML content in a string. + */ +var XMLStringLexer = /** @class */ (function () { + /** + * Initializes a new instance of `XMLStringLexer`. + * + * @param str - the string to tokenize and lex + * @param options - lexer options + */ + function XMLStringLexer(str, options) { + this._options = { + skipWhitespaceOnlyText: false + }; + this.err = { line: -1, col: -1, index: -1, str: "" }; + this._str = str; + this._index = 0; + this._length = str.length; + if (options) { + this._options.skipWhitespaceOnlyText = options.skipWhitespaceOnlyText || false; + } + } + /** + * Returns the next token. + */ + XMLStringLexer.prototype.nextToken = function () { + if (this.eof()) { + return { type: interfaces_1.TokenType.EOF }; + } + var token = (this.skipIfStartsWith('<') ? this.openBracket() : this.text()); + if (this._options.skipWhitespaceOnlyText) { + if (token.type === interfaces_1.TokenType.Text && + XMLStringLexer.isWhiteSpaceToken(token)) { + token = this.nextToken(); + } + } + return token; + }; + /** + * Branches from an opening bracket (`<`). + */ + XMLStringLexer.prototype.openBracket = function () { + if (this.skipIfStartsWith('?')) { + if (this.skipIfStartsWith('xml')) { + if (XMLStringLexer.isSpace(this._str[this._index])) { + return this.declaration(); + } + else { + // a processing instruction starting with xml. e.g. + this.seek(-3); + return this.pi(); + } + } + else { + return this.pi(); + } + } + else if (this.skipIfStartsWith('!')) { + if (this.skipIfStartsWith('--')) { + return this.comment(); + } + else if (this.skipIfStartsWith('[CDATA[')) { + return this.cdata(); + } + else if (this.skipIfStartsWith('DOCTYPE')) { + return this.doctype(); + } + else { + this.throwError("Invalid '!' in opening tag."); + } + } + else if (this.skipIfStartsWith('/')) { + return this.closeTag(); + } + else { + return this.openTag(); + } + }; + /** + * Produces an XML declaration token. + */ + XMLStringLexer.prototype.declaration = function () { + var version = ''; + var encoding = ''; + var standalone = ''; + while (!this.eof()) { + this.skipSpace(); + if (this.skipIfStartsWith('?>')) { + return { type: interfaces_1.TokenType.Declaration, version: version, encoding: encoding, standalone: standalone }; + } + else { + // attribute name + var _a = __read(this.attribute(), 2), attName = _a[0], attValue = _a[1]; + if (attName === 'version') + version = attValue; + else if (attName === 'encoding') + encoding = attValue; + else if (attName === 'standalone') + standalone = attValue; + else + this.throwError('Invalid attribute name: ' + attName); + } + } + this.throwError('Missing declaration end symbol `?>`'); + }; + /** + * Produces a doc type token. + */ + XMLStringLexer.prototype.doctype = function () { + var pubId = ''; + var sysId = ''; + // name + this.skipSpace(); + var name = this.takeUntil2('[', '>', true); + this.skipSpace(); + if (this.skipIfStartsWith('PUBLIC')) { + pubId = this.quotedString(); + sysId = this.quotedString(); + } + else if (this.skipIfStartsWith('SYSTEM')) { + sysId = this.quotedString(); + } + // skip internal subset + this.skipSpace(); + if (this.skipIfStartsWith('[')) { + // skip internal subset nodes + this.skipUntil(']'); + if (!this.skipIfStartsWith(']')) { + this.throwError('Missing end bracket of DTD internal subset'); + } + } + this.skipSpace(); + if (!this.skipIfStartsWith('>')) { + this.throwError('Missing doctype end symbol `>`'); + } + return { type: interfaces_1.TokenType.DocType, name: name, pubId: pubId, sysId: sysId }; + }; + /** + * Produces a processing instruction token. + */ + XMLStringLexer.prototype.pi = function () { + var target = this.takeUntilStartsWith('?>', true); + if (this.eof()) { + this.throwError('Missing processing instruction end symbol `?>`'); + } + this.skipSpace(); + if (this.skipIfStartsWith('?>')) { + return { type: interfaces_1.TokenType.PI, target: target, data: '' }; + } + var data = this.takeUntilStartsWith('?>'); + if (this.eof()) { + this.throwError('Missing processing instruction end symbol `?>`'); + } + this.seek(2); + return { type: interfaces_1.TokenType.PI, target: target, data: data }; + }; + /** + * Produces a text token. + * + */ + XMLStringLexer.prototype.text = function () { + var data = this.takeUntil('<'); + return { type: interfaces_1.TokenType.Text, data: data }; + }; + /** + * Produces a comment token. + * + */ + XMLStringLexer.prototype.comment = function () { + var data = this.takeUntilStartsWith('-->'); + if (this.eof()) { + this.throwError('Missing comment end symbol `-->`'); + } + this.seek(3); + return { type: interfaces_1.TokenType.Comment, data: data }; + }; + /** + * Produces a CDATA token. + * + */ + XMLStringLexer.prototype.cdata = function () { + var data = this.takeUntilStartsWith(']]>'); + if (this.eof()) { + this.throwError('Missing CDATA end symbol `]>`'); + } + this.seek(3); + return { type: interfaces_1.TokenType.CDATA, data: data }; + }; + /** + * Produces an element token. + */ + XMLStringLexer.prototype.openTag = function () { + // element name + this.skipSpace(); + var name = this.takeUntil2('>', '/', true); + this.skipSpace(); + if (this.skipIfStartsWith('>')) { + return { type: interfaces_1.TokenType.Element, name: name, attributes: [], selfClosing: false }; + } + else if (this.skipIfStartsWith('/>')) { + return { type: interfaces_1.TokenType.Element, name: name, attributes: [], selfClosing: true }; + } + // attributes + var attributes = []; + while (!this.eof()) { + // end tag + this.skipSpace(); + if (this.skipIfStartsWith('>')) { + return { type: interfaces_1.TokenType.Element, name: name, attributes: attributes, selfClosing: false }; + } + else if (this.skipIfStartsWith('/>')) { + return { type: interfaces_1.TokenType.Element, name: name, attributes: attributes, selfClosing: true }; + } + var attr = this.attribute(); + attributes.push(attr); + } + this.throwError('Missing opening element tag end symbol `>`'); + }; + /** + * Produces a closing tag token. + * + */ + XMLStringLexer.prototype.closeTag = function () { + this.skipSpace(); + var name = this.takeUntil('>', true); + this.skipSpace(); + if (!this.skipIfStartsWith('>')) { + this.throwError('Missing closing element tag end symbol `>`'); + } + return { type: interfaces_1.TokenType.ClosingTag, name: name }; + }; + /** + * Reads an attribute name, value pair + */ + XMLStringLexer.prototype.attribute = function () { + // attribute name + this.skipSpace(); + var name = this.takeUntil('=', true); + this.skipSpace(); + if (!this.skipIfStartsWith('=')) { + this.throwError('Missing equals sign before attribute value'); + } + // attribute value + var value = this.quotedString(); + return [name, value]; + }; + /** + * Reads a string between double or single quotes. + */ + XMLStringLexer.prototype.quotedString = function () { + this.skipSpace(); + var startQuote = this.take(1); + if (!XMLStringLexer.isQuote(startQuote)) { + this.throwError('Missing start quote character before quoted value'); + } + var value = this.takeUntil(startQuote); + if (!this.skipIfStartsWith(startQuote)) { + this.throwError('Missing end quote character after quoted value'); + } + return value; + }; + /** + * Determines if the current index is at or past the end of input string. + */ + XMLStringLexer.prototype.eof = function () { return this._index >= this._length; }; + /** + * Skips the length of the given string if the string from current position + * starts with the given string. + * + * @param str - the string to match + */ + XMLStringLexer.prototype.skipIfStartsWith = function (str) { + var strLength = str.length; + if (strLength === 1) { + if (this._str[this._index] === str) { + this._index++; + return true; + } + else { + return false; + } + } + for (var i = 0; i < strLength; i++) { + if (this._str[this._index + i] !== str[i]) + return false; + } + this._index += strLength; + return true; + }; + /** + * Seeks a number of character codes. + * + * @param count - number of characters to skip + */ + XMLStringLexer.prototype.seek = function (count) { + this._index += count; + if (this._index < 0) + this._index = 0; + if (this._index > this._length) + this._index = this._length; + }; + /** + * Skips space characters. + */ + XMLStringLexer.prototype.skipSpace = function () { + while (!this.eof() && (XMLStringLexer.isSpace(this._str[this._index]))) { + this._index++; + } + }; + /** + * Takes a given number of characters. + * + * @param count - character count + */ + XMLStringLexer.prototype.take = function (count) { + if (count === 1) { + return this._str[this._index++]; + } + var startIndex = this._index; + this.seek(count); + return this._str.slice(startIndex, this._index); + }; + /** + * Takes characters until the next character matches `char`. + * + * @param char - a character to match + * @param space - whether a space character stops iteration + */ + XMLStringLexer.prototype.takeUntil = function (char, space) { + if (space === void 0) { space = false; } + var startIndex = this._index; + while (this._index < this._length) { + var c = this._str[this._index]; + if (c !== char && (!space || !XMLStringLexer.isSpace(c))) { + this._index++; + } + else { + break; + } + } + return this._str.slice(startIndex, this._index); + }; + /** + * Takes characters until the next character matches `char1` or `char1`. + * + * @param char1 - a character to match + * @param char2 - a character to match + * @param space - whether a space character stops iteration + */ + XMLStringLexer.prototype.takeUntil2 = function (char1, char2, space) { + if (space === void 0) { space = false; } + var startIndex = this._index; + while (this._index < this._length) { + var c = this._str[this._index]; + if (c !== char1 && c !== char2 && (!space || !XMLStringLexer.isSpace(c))) { + this._index++; + } + else { + break; + } + } + return this._str.slice(startIndex, this._index); + }; + /** + * Takes characters until the next characters matches `str`. + * + * @param str - a string to match + * @param space - whether a space character stops iteration + */ + XMLStringLexer.prototype.takeUntilStartsWith = function (str, space) { + if (space === void 0) { space = false; } + var startIndex = this._index; + var strLength = str.length; + while (this._index < this._length) { + var match = true; + for (var i = 0; i < strLength; i++) { + var c = this._str[this._index + i]; + var char = str[i]; + if (space && XMLStringLexer.isSpace(c)) { + return this._str.slice(startIndex, this._index); + } + else if (c !== char) { + this._index++; + match = false; + break; + } + } + if (match) + return this._str.slice(startIndex, this._index); + } + this._index = this._length; + return this._str.slice(startIndex); + }; + /** + * Skips characters until the next character matches `char`. + * + * @param char - a character to match + */ + XMLStringLexer.prototype.skipUntil = function (char) { + while (this._index < this._length) { + var c = this._str[this._index]; + if (c !== char) { + this._index++; + } + else { + break; + } + } + }; + /** + * Determines if the given token is entirely whitespace. + * + * @param token - the token to check + */ + XMLStringLexer.isWhiteSpaceToken = function (token) { + var str = token.data; + for (var i = 0; i < str.length; i++) { + var c = str[i]; + if (c !== ' ' && c !== '\n' && c !== '\r' && c !== '\t' && c !== '\f') + return false; + } + return true; + }; + /** + * Determines if the given character is whitespace. + * + * @param char - the character to check + */ + XMLStringLexer.isSpace = function (char) { + return char === ' ' || char === '\n' || char === '\r' || char === '\t'; + }; + /** + * Determines if the given character is a quote character. + * + * @param char - the character to check + */ + XMLStringLexer.isQuote = function (char) { + return (char === '"' || char === '\''); + }; + /** + * Throws a parser error and records the line and column numbers in the parsed + * string. + * + * @param msg - error message + */ + XMLStringLexer.prototype.throwError = function (msg) { + var regexp = /\r\n|\r|\n/g; + var match = null; + var line = 0; + var firstNewLineIndex = 0; + var lastNewlineIndex = this._str.length; + while ((match = regexp.exec(this._str)) !== null) { + if (match === null) + break; + line++; + if (match.index < this._index) + firstNewLineIndex = regexp.lastIndex; + if (match.index > this._index) { + lastNewlineIndex = match.index; + break; + } + } + this.err = { + line: line, + col: this._index - firstNewLineIndex, + index: this._index, + str: this._str.substring(firstNewLineIndex, lastNewlineIndex) + }; + throw new Error(msg + "\nIndex: " + this.err.index + + "\nLn: " + this.err.line + ", Col: " + this.err.col + + "\nInput: " + this.err.str); + }; + /** + * Returns an iterator for the lexer. + */ + XMLStringLexer.prototype[Symbol.iterator] = function () { + this._index = 0; + return { + next: function () { + var token = this.nextToken(); + if (token.type === interfaces_1.TokenType.EOF) { + return { done: true, value: null }; + } + else { + return { done: false, value: token }; + } + }.bind(this) + }; + }; + return XMLStringLexer; +}()); +exports.XMLStringLexer = XMLStringLexer; +//# sourceMappingURL=XMLStringLexer.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/parser/XMLStringLexer.js.map b/node_modules/@oozcitak/dom/lib/parser/XMLStringLexer.js.map new file mode 100644 index 0000000..41d5626 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/parser/XMLStringLexer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"XMLStringLexer.js","sourceRoot":"","sources":["../../src/parser/XMLStringLexer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAIqB;AAErB;;GAEG;AACH;IAWE;;;;;OAKG;IACH,wBAAY,GAAW,EAAE,OAAkC;QAZnD,aAAQ,GAAoB;YAClC,sBAAsB,EAAE,KAAK;SAC9B,CAAA;QAED,QAAG,GAA8D,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAA;QASxG,IAAI,CAAC,IAAI,GAAG,GAAG,CAAA;QACf,IAAI,CAAC,MAAM,GAAG,CAAC,CAAA;QACf,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,MAAM,CAAA;QACzB,IAAI,OAAO,EAAE;YACX,IAAI,CAAC,QAAQ,CAAC,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,IAAI,KAAK,CAAA;SAC/E;IACH,CAAC;IAED;;OAEG;IACH,kCAAS,GAAT;QACE,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE;YACd,OAAO,EAAE,IAAI,EAAE,sBAAS,CAAC,GAAG,EAAE,CAAA;SAC/B;QAED,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;QAE3E,IAAI,I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,GAAG,CAAC,GAAG,CAAC,CAAA;IAC/B,CAAC;IAED;;OAEG;IACH,yBAAC,MAAM,CAAC,QAAQ,CAAC,GAAjB;QACE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAA;QAEf,OAAO;YACL,IAAI,EAAE;gBACJ,IAAM,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;gBAC9B,IAAI,KAAK,CAAC,IAAI,KAAK,sBAAS,CAAC,GAAG,EAAE;oBAChC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;iBACnC;qBAAM;oBACL,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;iBACrC;YACH,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;SACb,CAAA;IACH,CAAC;IAEH,qBAAC;AAAD,CAAC,AA5gBD,IA4gBC;AA5gBY,wCAAc"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/parser/index.d.ts b/node_modules/@oozcitak/dom/lib/parser/index.d.ts new file mode 100644 index 0000000..6f3bbbc --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/parser/index.d.ts @@ -0,0 +1 @@ +export { DOMParserImpl as DOMParser } from "./DOMParserImpl"; diff --git a/node_modules/@oozcitak/dom/lib/parser/index.js b/node_modules/@oozcitak/dom/lib/parser/index.js new file mode 100644 index 0000000..e478e4b --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/parser/index.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// Export classes +var DOMParserImpl_1 = require("./DOMParserImpl"); +exports.DOMParser = DOMParserImpl_1.DOMParserImpl; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/parser/index.js.map b/node_modules/@oozcitak/dom/lib/parser/index.js.map new file mode 100644 index 0000000..bad175c --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/parser/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":";;AAAA,iBAAiB;AACjB,iDAA4D;AAAnD,oCAAA,aAAa,CAAa"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/parser/interfaces.d.ts b/node_modules/@oozcitak/dom/lib/parser/interfaces.d.ts new file mode 100644 index 0000000..58a29c0 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/parser/interfaces.d.ts @@ -0,0 +1,131 @@ +import { Document } from "../dom/interfaces"; +/** + * Represents a parser for XML and HTML content. + * + * See: https://w3c.github.io/DOM-Parsing/#the-domparser-interface + */ +export interface DOMParser { + /** + * Parses the given string and returns a document object. + * + * @param source - the string containing the document tree. + * @param mimeType - the mime type of the document + */ + parseFromString(source: string, mimeType: MimeType): Document; +} +/** + * Defines the mime type of the document. + */ +export declare type MimeType = 'text/html' | 'text/xml' | 'application/xml' | 'application/xhtml+xml' | 'image/svg+xml'; +/** + * Represents a token. + */ +export interface XMLToken { + /** + * Token type. + */ + readonly type: TokenType; +} +/** + * Represents an end-of-file token. + */ +export interface EOFToken extends XMLToken { + readonly type: TokenType.EOF; +} +/** + * Represents an XML declaration token. + */ +export interface DeclarationToken extends XMLToken { + readonly type: TokenType.Declaration; + readonly version: string; + readonly encoding: string; + readonly standalone: string; +} +/** + * Represents a DocType token. + */ +export interface DocTypeToken extends XMLToken { + readonly type: TokenType.DocType; + readonly name: string; + readonly pubId: string; + readonly sysId: string; +} +/** + * Represents a character data token. + */ +export interface CharacterDataToken extends XMLToken { + readonly data: string; +} +/** + * Represents a comment token. + */ +export interface CommentToken extends CharacterDataToken { + readonly type: TokenType.Comment; +} +/** + * Represents a CDATA token. + */ +export interface CDATAToken extends CharacterDataToken { + readonly type: TokenType.CDATA; +} +/** + * Represents a text token. + */ +export interface TextToken extends CharacterDataToken { + readonly type: TokenType.Text; +} +/** + * Represents a processing instruction token. + */ +export interface PIToken extends CharacterDataToken { + readonly type: TokenType.PI; + readonly target: string; +} +/** + * Represents an element token. + */ +export interface ElementToken extends XMLToken { + readonly type: TokenType.Element; + readonly name: string; + readonly attributes: Array<[string, string]>; + readonly selfClosing: boolean; +} +/** + * Represents a closing tag token. + */ +export interface ClosingTagToken extends XMLToken { + readonly type: TokenType.ClosingTag; + readonly name: string; +} +/** + * Represents a lexer for XML content. + */ +export interface XMLLexer extends Iterable { + /** + * Returns the next token. + */ + nextToken(): XMLToken; +} +/** + * Defines lexer options. + */ +export declare type XMLLexerOptions = { + /** + * Determines whether whitespace-only text nodes are skipped or not. + */ + skipWhitespaceOnlyText: boolean; +}; +/** + * Defines the type of a token. + */ +export declare enum TokenType { + EOF = 0, + Declaration = 1, + DocType = 2, + Element = 3, + Text = 4, + CDATA = 5, + PI = 6, + Comment = 7, + ClosingTag = 8 +} diff --git a/node_modules/@oozcitak/dom/lib/parser/interfaces.js b/node_modules/@oozcitak/dom/lib/parser/interfaces.js new file mode 100644 index 0000000..287b513 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/parser/interfaces.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Defines the type of a token. + */ +var TokenType; +(function (TokenType) { + TokenType[TokenType["EOF"] = 0] = "EOF"; + TokenType[TokenType["Declaration"] = 1] = "Declaration"; + TokenType[TokenType["DocType"] = 2] = "DocType"; + TokenType[TokenType["Element"] = 3] = "Element"; + TokenType[TokenType["Text"] = 4] = "Text"; + TokenType[TokenType["CDATA"] = 5] = "CDATA"; + TokenType[TokenType["PI"] = 6] = "PI"; + TokenType[TokenType["Comment"] = 7] = "Comment"; + TokenType[TokenType["ClosingTag"] = 8] = "ClosingTag"; +})(TokenType = exports.TokenType || (exports.TokenType = {})); +//# sourceMappingURL=interfaces.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/parser/interfaces.js.map b/node_modules/@oozcitak/dom/lib/parser/interfaces.js.map new file mode 100644 index 0000000..e718bc0 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/parser/interfaces.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/parser/interfaces.ts"],"names":[],"mappings":";;AAuIA;;GAEG;AACH,IAAY,SAUX;AAVD,WAAY,SAAS;IACnB,uCAAG,CAAA;IACH,uDAAW,CAAA;IACX,+CAAO,CAAA;IACP,+CAAO,CAAA;IACP,yCAAI,CAAA;IACJ,2CAAK,CAAA;IACL,qCAAE,CAAA;IACF,+CAAO,CAAA;IACP,qDAAU,CAAA;AACZ,CAAC,EAVW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAUpB"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/serializer/LocalNameSet.d.ts b/node_modules/@oozcitak/dom/lib/serializer/LocalNameSet.d.ts new file mode 100644 index 0000000..44282c3 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/serializer/LocalNameSet.d.ts @@ -0,0 +1,27 @@ +/** + * Represents a set of unique attribute namespaceURI and localName pairs. + * This set will contain tuples of unique attribute namespaceURI and + * localName pairs, and is populated as each attr is processed. This set is + * used to [optionally] enforce the well-formed constraint that an element + * cannot have two attributes with the same namespaceURI and localName. + * This can occur when two otherwise identical attributes on the same + * element differ only by their prefix values. + */ +export declare class LocalNameSet { + private _items; + private _nullItems; + /** + * Adds or replaces a tuple. + * + * @param ns - namespace URI + * @param localName - attribute local name + */ + set(ns: string | null, localName: string): void; + /** + * Determines if the given tuple exists in the set. + * + * @param ns - namespace URI + * @param localName - attribute local name + */ + has(ns: string | null, localName: string): boolean; +} diff --git a/node_modules/@oozcitak/dom/lib/serializer/LocalNameSet.js b/node_modules/@oozcitak/dom/lib/serializer/LocalNameSet.js new file mode 100644 index 0000000..f0cb377 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/serializer/LocalNameSet.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Represents a set of unique attribute namespaceURI and localName pairs. + * This set will contain tuples of unique attribute namespaceURI and + * localName pairs, and is populated as each attr is processed. This set is + * used to [optionally] enforce the well-formed constraint that an element + * cannot have two attributes with the same namespaceURI and localName. + * This can occur when two otherwise identical attributes on the same + * element differ only by their prefix values. + */ +var LocalNameSet = /** @class */ (function () { + function LocalNameSet() { + // tuple storage + this._items = {}; + this._nullItems = {}; + } + /** + * Adds or replaces a tuple. + * + * @param ns - namespace URI + * @param localName - attribute local name + */ + LocalNameSet.prototype.set = function (ns, localName) { + if (ns === null) { + this._nullItems[localName] = true; + } + else if (this._items[ns]) { + this._items[ns][localName] = true; + } + else { + this._items[ns] = {}; + this._items[ns][localName] = true; + } + }; + /** + * Determines if the given tuple exists in the set. + * + * @param ns - namespace URI + * @param localName - attribute local name + */ + LocalNameSet.prototype.has = function (ns, localName) { + if (ns === null) { + return this._nullItems[localName] === true; + } + else if (this._items[ns]) { + return this._items[ns][localName] === true; + } + else { + return false; + } + }; + return LocalNameSet; +}()); +exports.LocalNameSet = LocalNameSet; +//# sourceMappingURL=LocalNameSet.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/serializer/LocalNameSet.js.map b/node_modules/@oozcitak/dom/lib/serializer/LocalNameSet.js.map new file mode 100644 index 0000000..49c8e95 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/serializer/LocalNameSet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"LocalNameSet.js","sourceRoot":"","sources":["../../src/serializer/LocalNameSet.ts"],"names":[],"mappings":";;AAAA;;;;;;;;GAQG;AACH;IAAA;QAEE,gBAAgB;QACR,WAAM,GAAkD,EAAE,CAAA;QAC1D,eAAU,GAA+B,EAAE,CAAA;IAmCrD,CAAC;IAjCC;;;;;OAKG;IACH,0BAAG,GAAH,UAAI,EAAiB,EAAE,SAAiB;QACtC,IAAI,EAAE,KAAK,IAAI,EAAE;YACf,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;SAClC;aAAM,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;YAC1B,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;SAClC;aAAM;YACL,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,CAAA;YACpB,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;SAClC;IACH,CAAC;IAED;;;;;OAKG;IACH,0BAAG,GAAH,UAAI,EAAiB,EAAE,SAAiB;QACtC,IAAI,EAAE,KAAK,IAAI,EAAE;YACf,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,IAAI,CAAA;SAC3C;aAAM,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;YAC1B,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,KAAK,IAAI,CAAA;SAC3C;aAAM;YACL,OAAO,KAAK,CAAA;SACb;IACH,CAAC;IAEH,mBAAC;AAAD,CAAC,AAvCD,IAuCC;AAvCY,oCAAY"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/serializer/NamespacePrefixMap.d.ts b/node_modules/@oozcitak/dom/lib/serializer/NamespacePrefixMap.d.ts new file mode 100644 index 0000000..72a491e --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/serializer/NamespacePrefixMap.d.ts @@ -0,0 +1,52 @@ +/** + * A namespace prefix map is a map that associates namespaceURI and namespace + * prefix lists, where namespaceURI values are the map's unique keys (which can + * include the null value representing no namespace), and ordered lists of + * associated prefix values are the map's key values. The namespace prefix map + * will be populated by previously seen namespaceURIs and all their previously + * encountered prefix associations for a given node and its ancestors. + * + * _Note:_ The last seen prefix for a given namespaceURI is at the end of its + * respective list. The list is searched to find potentially matching prefixes, + * and if no matches are found for the given namespaceURI, then the last prefix + * in the list is used. See copy a namespace prefix map and retrieve a preferred + * prefix string for additional details. + * + * See: https://w3c.github.io/DOM-Parsing/#the-namespace-prefix-map + */ +export declare class NamespacePrefixMap { + private _items; + private _nullItems; + /** + * Creates a copy of the map. + */ + copy(): NamespacePrefixMap; + /** + * Retrieves a preferred prefix string from the namespace prefix map. + * + * @param preferredPrefix - preferred prefix string + * @param ns - namespace + */ + get(preferredPrefix: string | null, ns: string | null): string | null; + /** + * Checks if a prefix string is found in the namespace prefix map associated + * with the given namespace. + * + * @param prefix - prefix string + * @param ns - namespace + */ + has(prefix: string, ns: string | null): boolean; + /** + * Checks if a prefix string is found in the namespace prefix map. + * + * @param prefix - prefix string + */ + hasPrefix(prefix: string): boolean; + /** + * Adds a prefix string associated with a namespace to the prefix map. + * + * @param prefix - prefix string + * @param ns - namespace + */ + set(prefix: string, ns: string | null): void; +} diff --git a/node_modules/@oozcitak/dom/lib/serializer/NamespacePrefixMap.js b/node_modules/@oozcitak/dom/lib/serializer/NamespacePrefixMap.js new file mode 100644 index 0000000..e13defa --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/serializer/NamespacePrefixMap.js @@ -0,0 +1,151 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * A namespace prefix map is a map that associates namespaceURI and namespace + * prefix lists, where namespaceURI values are the map's unique keys (which can + * include the null value representing no namespace), and ordered lists of + * associated prefix values are the map's key values. The namespace prefix map + * will be populated by previously seen namespaceURIs and all their previously + * encountered prefix associations for a given node and its ancestors. + * + * _Note:_ The last seen prefix for a given namespaceURI is at the end of its + * respective list. The list is searched to find potentially matching prefixes, + * and if no matches are found for the given namespaceURI, then the last prefix + * in the list is used. See copy a namespace prefix map and retrieve a preferred + * prefix string for additional details. + * + * See: https://w3c.github.io/DOM-Parsing/#the-namespace-prefix-map + */ +var NamespacePrefixMap = /** @class */ (function () { + function NamespacePrefixMap() { + this._items = {}; + this._nullItems = []; + } + /** + * Creates a copy of the map. + */ + NamespacePrefixMap.prototype.copy = function () { + /** + * To copy a namespace prefix map map means to copy the map's keys into a + * new empty namespace prefix map, and to copy each of the values in the + * namespace prefix list associated with each keys' value into a new list + * which should be associated with the respective key in the new map. + */ + var mapCopy = new NamespacePrefixMap(); + for (var key in this._items) { + mapCopy._items[key] = this._items[key].slice(0); + } + mapCopy._nullItems = this._nullItems.slice(0); + return mapCopy; + }; + /** + * Retrieves a preferred prefix string from the namespace prefix map. + * + * @param preferredPrefix - preferred prefix string + * @param ns - namespace + */ + NamespacePrefixMap.prototype.get = function (preferredPrefix, ns) { + /** + * 1. Let candidates list be the result of retrieving a list from map where + * there exists a key in map that matches the value of ns or if there is no + * such key, then stop running these steps, and return the null value. + */ + var candidatesList = ns === null ? this._nullItems : (this._items[ns] || null); + if (candidatesList === null) { + return null; + } + /** + * 2. Otherwise, for each prefix value prefix in candidates list, iterating + * from beginning to end: + * + * _Note:_ There will always be at least one prefix value in the list. + */ + var prefix = null; + for (var i = 0; i < candidatesList.length; i++) { + prefix = candidatesList[i]; + /** + * 2.1. If prefix matches preferred prefix, then stop running these steps + * and return prefix. + */ + if (prefix === preferredPrefix) { + return prefix; + } + } + /** + * 2.2. If prefix is the last item in the candidates list, then stop + * running these steps and return prefix. + */ + return prefix; + }; + /** + * Checks if a prefix string is found in the namespace prefix map associated + * with the given namespace. + * + * @param prefix - prefix string + * @param ns - namespace + */ + NamespacePrefixMap.prototype.has = function (prefix, ns) { + /** + * 1. Let candidates list be the result of retrieving a list from map where + * there exists a key in map that matches the value of ns or if there is + * no such key, then stop running these steps, and return false. + */ + var candidatesList = ns === null ? this._nullItems : (this._items[ns] || null); + if (candidatesList === null) { + return false; + } + /** + * 2. If the value of prefix occurs at least once in candidates list, + * return true, otherwise return false. + */ + return (candidatesList.indexOf(prefix) !== -1); + }; + /** + * Checks if a prefix string is found in the namespace prefix map. + * + * @param prefix - prefix string + */ + NamespacePrefixMap.prototype.hasPrefix = function (prefix) { + if (this._nullItems.indexOf(prefix) !== -1) + return true; + for (var key in this._items) { + if (this._items[key].indexOf(prefix) !== -1) + return true; + } + return false; + }; + /** + * Adds a prefix string associated with a namespace to the prefix map. + * + * @param prefix - prefix string + * @param ns - namespace + */ + NamespacePrefixMap.prototype.set = function (prefix, ns) { + /** + * 1. Let candidates list be the result of retrieving a list from map where + * there exists a key in map that matches the value of ns or if there is + * no such key, then let candidates list be null. + */ + var candidatesList = ns === null ? this._nullItems : (this._items[ns] || null); + /** + * 2. If candidates list is null, then create a new list with prefix as the + * only item in the list, and associate that list with a new key ns in map. + * 3. Otherwise, append prefix to the end of candidates list. + * + * _Note:_ The steps in retrieve a preferred prefix string use the list to + * track the most recently used (MRU) prefix associated with a given + * namespace, which will be the prefix at the end of the list. This list + * may contain duplicates of the same prefix value seen earlier + * (and that's OK). + */ + if (ns !== null && candidatesList === null) { + this._items[ns] = [prefix]; + } + else { + candidatesList.push(prefix); + } + }; + return NamespacePrefixMap; +}()); +exports.NamespacePrefixMap = NamespacePrefixMap; +//# sourceMappingURL=NamespacePrefixMap.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/serializer/NamespacePrefixMap.js.map b/node_modules/@oozcitak/dom/lib/serializer/NamespacePrefixMap.js.map new file mode 100644 index 0000000..d5ae4c1 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/serializer/NamespacePrefixMap.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NamespacePrefixMap.js","sourceRoot":"","sources":["../../src/serializer/NamespacePrefixMap.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;GAeG;AACH;IAAA;QAEU,WAAM,GAAgC,EAAE,CAAA;QACxC,eAAU,GAAa,EAAE,CAAA;IAmInC,CAAC;IAjIC;;OAEG;IACH,iCAAI,GAAJ;QACE;;;;;WAKG;QACH,IAAM,OAAO,GAAG,IAAI,kBAAkB,EAAE,CAAA;QACxC,KAAK,IAAM,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE;YAC7B,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CA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,GAAT,UAAU,MAAc;QACtB,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAAE,OAAO,IAAI,CAAA;QACvD,KAAK,IAAM,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE;YAC7B,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAAE,OAAO,IAAI,CAAA;SACzD;QAED,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;;;;OAKG;IACH,gCAAG,GAAH,UAAI,MAAc,EAAE,EAAiB;QACnC;;;;WAIG;QACH,IAAM,cAAc,GAAG,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAA;QAEhF;;;;;;;;;;WAUG;QACH,IAAI,EAAE,KAAK,IAAI,IAAI,cAAc,KAAK,IAAI,EAAE;YAC1C,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;SAC3B;aAAM;YACL,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;SAC5B;IACH,CAAC;IAEH,yBAAC;AAAD,CAAC,AAtID,IAsIC;AAtIY,gDAAkB"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl.d.ts b/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl.d.ts new file mode 100644 index 0000000..78b8166 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl.d.ts @@ -0,0 +1,166 @@ +import { Node } from "../dom/interfaces"; +import { XMLSerializer } from "./interfaces"; +/** + * Represents an XML serializer. + * + * Implements: https://www.w3.org/TR/DOM-Parsing/#serializing + */ +export declare class XMLSerializerImpl implements XMLSerializer { + private static _VoidElementNames; + /** @inheritdoc */ + serializeToString(root: Node): string; + /** + * Produces an XML serialization of the given node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + private _xmlSerialization; + /** + * Produces an XML serialization of a node. + * + * @param node - node to serialize + * @param namespace - context namespace + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param requireWellFormed - whether to check conformance + */ + private _serializeNodeNS; + /** + * Produces an XML serialization of a node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + private _serializeNode; + /** + * Produces an XML serialization of an element node. + * + * @param node - node to serialize + * @param namespace - context namespace + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param requireWellFormed - whether to check conformance + */ + private _serializeElementNS; + /** + * Produces an XML serialization of a document node. + * + * @param node - node to serialize + * @param namespace - context namespace + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param requireWellFormed - whether to check conformance + */ + private _serializeDocumentNS; + /** + * Produces an XML serialization of a comment node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + private _serializeComment; + /** + * Produces an XML serialization of a text node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + * @param level - current depth of the XML tree + */ + private _serializeText; + /** + * Produces an XML serialization of a document fragment node. + * + * @param node - node to serialize + * @param namespace - context namespace + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param requireWellFormed - whether to check conformance + */ + private _serializeDocumentFragmentNS; + /** + * Produces an XML serialization of a document type node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + private _serializeDocumentType; + /** + * Produces an XML serialization of a processing instruction node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + private _serializeProcessingInstruction; + /** + * Produces an XML serialization of a CDATA node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + private _serializeCData; + /** + * Produces an XML serialization of the attributes of an element node. + * + * @param node - node to serialize + * @param map - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param localPrefixesMap - local prefixes map + * @param ignoreNamespaceDefinitionAttribute - whether to ignore namespace + * attributes + * @param requireWellFormed - whether to check conformance + */ + private _serializeAttributesNS; + /** + * Records namespace information for the given element and returns the + * default namespace attribute value. + * + * @param node - element node to process + * @param map - namespace prefix map + * @param localPrefixesMap - local prefixes map + */ + private _recordNamespaceInformation; + /** + * Generates a new prefix for the given namespace. + * + * @param newNamespace - a namespace to generate prefix for + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + */ + private _generatePrefix; + /** + * Produces an XML serialization of an attribute value. + * + * @param value - attribute value + * @param requireWellFormed - whether to check conformance + */ + private _serializeAttributeValue; + /** + * Produces an XML serialization of an element node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + private _serializeElement; + /** + * Produces an XML serialization of a document node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + private _serializeDocument; + /** + * Produces an XML serialization of a document fragment node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + private _serializeDocumentFragment; + /** + * Produces an XML serialization of the attributes of an element node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + private _serializeAttributes; +} diff --git a/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl.js b/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl.js new file mode 100644 index 0000000..1161510 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl.js @@ -0,0 +1,1479 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("../dom/interfaces"); +var LocalNameSet_1 = require("./LocalNameSet"); +var NamespacePrefixMap_1 = require("./NamespacePrefixMap"); +var DOMException_1 = require("../dom/DOMException"); +var infra_1 = require("@oozcitak/infra"); +var algorithm_1 = require("../algorithm"); +/** + * Represents an XML serializer. + * + * Implements: https://www.w3.org/TR/DOM-Parsing/#serializing + */ +var XMLSerializerImpl = /** @class */ (function () { + function XMLSerializerImpl() { + } + /** @inheritdoc */ + XMLSerializerImpl.prototype.serializeToString = function (root) { + /** + * The serializeToString(root) method must produce an XML serialization + * of root passing a value of false for the require well-formed parameter, + * and return the result. + */ + return this._xmlSerialization(root, false); + }; + /** + * Produces an XML serialization of the given node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._xmlSerialization = function (node, requireWellFormed) { + // To increase performance, use a namespace-aware serializer only if the + // document has namespaced elements + if (node._nodeDocument === undefined || node._nodeDocument._hasNamespaces) { + /** From: https://w3c.github.io/DOM-Parsing/#xml-serialization + * + * 1. Let namespace be a context namespace with value null. + * The context namespace tracks the XML serialization algorithm's current + * default namespace. The context namespace is changed when either an Element + * Node has a default namespace declaration, or the algorithm generates a + * default namespace declaration for the Element Node to match its own + * namespace. The algorithm assumes no namespace (null) to start. + * 2. Let prefix map be a new namespace prefix map. + * 3. Add the XML namespace with prefix value "xml" to prefix map. + * 4. Let prefix index be a generated namespace prefix index with value 1. + * The generated namespace prefix index is used to generate a new unique + * prefix value when no suitable existing namespace prefix is available to + * serialize a node's namespaceURI (or the namespaceURI of one of node's + * attributes). See the generate a prefix algorithm. + */ + var namespace = null; + var prefixMap = new NamespacePrefixMap_1.NamespacePrefixMap(); + prefixMap.set("xml", infra_1.namespace.XML); + var prefixIndex = { value: 1 }; + /** + * 5. Return the result of running the XML serialization algorithm on node + * passing the context namespace namespace, namespace prefix map prefix map, + * generated namespace prefix index reference to prefix index, and the + * flag require well-formed. If an exception occurs during the execution + * of the algorithm, then catch that exception and throw an + * "InvalidStateError" DOMException. + */ + try { + return this._serializeNodeNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); + } + catch (_a) { + throw new DOMException_1.InvalidStateError(); + } + } + else { + try { + return this._serializeNode(node, requireWellFormed); + } + catch (_b) { + throw new DOMException_1.InvalidStateError(); + } + } + }; + /** + * Produces an XML serialization of a node. + * + * @param node - node to serialize + * @param namespace - context namespace + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeNodeNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed) { + switch (node.nodeType) { + case interfaces_1.NodeType.Element: + return this._serializeElementNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); + case interfaces_1.NodeType.Document: + return this._serializeDocumentNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); + case interfaces_1.NodeType.Comment: + return this._serializeComment(node, requireWellFormed); + case interfaces_1.NodeType.Text: + return this._serializeText(node, requireWellFormed); + case interfaces_1.NodeType.DocumentFragment: + return this._serializeDocumentFragmentNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); + case interfaces_1.NodeType.DocumentType: + return this._serializeDocumentType(node, requireWellFormed); + case interfaces_1.NodeType.ProcessingInstruction: + return this._serializeProcessingInstruction(node, requireWellFormed); + case interfaces_1.NodeType.CData: + return this._serializeCData(node, requireWellFormed); + default: + throw new Error("Unknown node type: " + node.nodeType); + } + }; + /** + * Produces an XML serialization of a node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeNode = function (node, requireWellFormed) { + switch (node.nodeType) { + case interfaces_1.NodeType.Element: + return this._serializeElement(node, requireWellFormed); + case interfaces_1.NodeType.Document: + return this._serializeDocument(node, requireWellFormed); + case interfaces_1.NodeType.Comment: + return this._serializeComment(node, requireWellFormed); + case interfaces_1.NodeType.Text: + return this._serializeText(node, requireWellFormed); + case interfaces_1.NodeType.DocumentFragment: + return this._serializeDocumentFragment(node, requireWellFormed); + case interfaces_1.NodeType.DocumentType: + return this._serializeDocumentType(node, requireWellFormed); + case interfaces_1.NodeType.ProcessingInstruction: + return this._serializeProcessingInstruction(node, requireWellFormed); + case interfaces_1.NodeType.CData: + return this._serializeCData(node, requireWellFormed); + default: + throw new Error("Unknown node type: " + node.nodeType); + } + }; + /** + * Produces an XML serialization of an element node. + * + * @param node - node to serialize + * @param namespace - context namespace + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeElementNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed) { + var e_1, _a; + /** + * From: https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node + * + * 1. If the require well-formed flag is set (its value is true), and this + * node's localName attribute contains the character ":" (U+003A COLON) or + * does not match the XML Name production, then throw an exception; the + * serialization of this node would not be a well-formed element. + */ + if (requireWellFormed && (node.localName.indexOf(":") !== -1 || + !algorithm_1.xml_isName(node.localName))) { + throw new Error("Node local name contains invalid characters (well-formed required)."); + } + /** + * 2. Let markup be the string "<" (U+003C LESS-THAN SIGN). + * 3. Let qualified name be an empty string. + * 4. Let skip end tag be a boolean flag with value false. + * 5. Let ignore namespace definition attribute be a boolean flag with value + * false. + * 6. Given prefix map, copy a namespace prefix map and let map be the + * result. + * 7. Let local prefixes map be an empty map. The map has unique Node prefix + * strings as its keys, with corresponding namespaceURI Node values as the + * map's key values (in this map, the null namespace is represented by the + * empty string). + * + * _Note:_ This map is local to each element. It is used to ensure there + * are no conflicting prefixes should a new namespace prefix attribute need + * to be generated. It is also used to enable skipping of duplicate prefix + * definitions when writing an element's attributes: the map allows the + * algorithm to distinguish between a prefix in the namespace prefix map + * that might be locally-defined (to the current Element) and one that is + * not. + * 8. Let local default namespace be the result of recording the namespace + * information for node given map and local prefixes map. + * + * _Note:_ The above step will update map with any found namespace prefix + * definitions, add the found prefix definitions to the local prefixes map + * and return a local default namespace value defined by a default namespace + * attribute if one exists. Otherwise it returns null. + * 9. Let inherited ns be a copy of namespace. + * 10. Let ns be the value of node's namespaceURI attribute. + */ + var markup = "<"; + var qualifiedName = ''; + var skipEndTag = false; + var ignoreNamespaceDefinitionAttribute = false; + var map = prefixMap.copy(); + var localPrefixesMap = {}; + var localDefaultNamespace = this._recordNamespaceInformation(node, map, localPrefixesMap); + var inheritedNS = namespace; + var ns = node.namespaceURI; + /** 11. If inherited ns is equal to ns, then: */ + if (inheritedNS === ns) { + /** + * 11.1. If local default namespace is not null, then set ignore + * namespace definition attribute to true. + */ + if (localDefaultNamespace !== null) { + ignoreNamespaceDefinitionAttribute = true; + } + /** + * 11.2. If ns is the XML namespace, then append to qualified name the + * concatenation of the string "xml:" and the value of node's localName. + * 11.3. Otherwise, append to qualified name the value of node's + * localName. The node's prefix if it exists, is dropped. + */ + if (ns === infra_1.namespace.XML) { + qualifiedName = 'xml:' + node.localName; + } + else { + qualifiedName = node.localName; + } + /** 11.4. Append the value of qualified name to markup. */ + markup += qualifiedName; + } + else { + /** + * 12. Otherwise, inherited ns is not equal to ns (the node's own + * namespace is different from the context namespace of its parent). + * Run these sub-steps: + * + * 12.1. Let prefix be the value of node's prefix attribute. + * 12.2. Let candidate prefix be the result of retrieving a preferred + * prefix string prefix from map given namespace ns. The above may return + * null if no namespace key ns exists in map. + */ + var prefix = node.prefix; + /** + * We don't need to run "retrieving a preferred prefix string" algorithm if + * the element has no prefix and its namespace matches to the default + * namespace. + * See: https://github.com/web-platform-tests/wpt/pull/16703 + */ + var candidatePrefix = null; + if (prefix !== null || ns !== localDefaultNamespace) { + candidatePrefix = map.get(prefix, ns); + } + /** + * 12.3. If the value of prefix matches "xmlns", then run the following + * steps: + */ + if (prefix === "xmlns") { + /** + * 12.3.1. If the require well-formed flag is set, then throw an error. + * An Element with prefix "xmlns" will not legally round-trip in a + * conforming XML parser. + */ + if (requireWellFormed) { + throw new Error("An element cannot have the 'xmlns' prefix (well-formed required)."); + } + /** + * 12.3.2. Let candidate prefix be the value of prefix. + */ + candidatePrefix = prefix; + } + /** + * 12.4.Found a suitable namespace prefix: if candidate prefix is not + * null (a namespace prefix is defined which maps to ns), then: + */ + if (candidatePrefix !== null) { + /** + * The following may serialize a different prefix than the Element's + * existing prefix if it already had one. However, the retrieving a + * preferred prefix string algorithm already tried to match the + * existing prefix if possible. + * + * 12.4.1. Append to qualified name the concatenation of candidate + * prefix, ":" (U+003A COLON), and node's localName. There exists on + * this node or the node's ancestry a namespace prefix definition that + * defines the node's namespace. + * 12.4.2. If the local default namespace is not null (there exists a + * locally-defined default namespace declaration attribute) and its + * value is not the XML namespace, then let inherited ns get the value + * of local default namespace unless the local default namespace is the + * empty string in which case let it get null (the context namespace + * is changed to the declared default, rather than this node's own + * namespace). + * + * _Note:_ Any default namespace definitions or namespace prefixes that + * define the XML namespace are omitted when serializing this node's + * attributes. + */ + qualifiedName = candidatePrefix + ':' + node.localName; + if (localDefaultNamespace !== null && localDefaultNamespace !== infra_1.namespace.XML) { + inheritedNS = localDefaultNamespace || null; + } + /** + * 12.4.3. Append the value of qualified name to markup. + */ + markup += qualifiedName; + /** 12.5. Otherwise, if prefix is not null, then: */ + } + else if (prefix !== null) { + /** + * _Note:_ By this step, there is no namespace or prefix mapping + * declaration in this node (or any parent node visited by this + * algorithm) that defines prefix otherwise the step labelled Found + * a suitable namespace prefix would have been followed. The sub-steps + * that follow will create a new namespace prefix declaration for prefix + * and ensure that prefix does not conflict with an existing namespace + * prefix declaration of the same localName in node's attribute list. + * + * 12.5.1. If the local prefixes map contains a key matching prefix, + * then let prefix be the result of generating a prefix providing as + * input map, ns, and prefix index. + */ + if (prefix in localPrefixesMap) { + prefix = this._generatePrefix(ns, map, prefixIndex); + } + /** + * 12.5.2. Add prefix to map given namespace ns. + * 12.5.3. Append to qualified name the concatenation of prefix, ":" + * (U+003A COLON), and node's localName. + * 12.5.4. Append the value of qualified name to markup. + */ + map.set(prefix, ns); + qualifiedName += prefix + ':' + node.localName; + markup += qualifiedName; + /** + * 12.5.5. Append the following to markup, in the order listed: + * + * _Note:_ The following serializes a namespace prefix declaration for + * prefix which was just added to the map. + * + * 12.5.5.1. " " (U+0020 SPACE); + * 12.5.5.2. The string "xmlns:"; + * 12.5.5.3. The value of prefix; + * 12.5.5.4. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 12.5.5.5. The result of serializing an attribute value given ns and + * the require well-formed flag as input; + * 12.5.5.6. """ (U+0022 QUOTATION MARK). + */ + markup += " xmlns:" + prefix + "=\"" + + this._serializeAttributeValue(ns, requireWellFormed) + "\""; + /** + * 12.5.5.7. If local default namespace is not null (there exists a + * locally-defined default namespace declaration attribute), then + * let inherited ns get the value of local default namespace unless the + * local default namespace is the empty string in which case let it get + * null. + */ + if (localDefaultNamespace !== null) { + inheritedNS = localDefaultNamespace || null; + } + /** + * 12.6. Otherwise, if local default namespace is null, or local + * default namespace is not null and its value is not equal to ns, then: + */ + } + else if (localDefaultNamespace === null || + (localDefaultNamespace !== null && localDefaultNamespace !== ns)) { + /** + * _Note:_ At this point, the namespace for this node still needs to be + * serialized, but there's no prefix (or candidate prefix) available; the + * following uses the default namespace declaration to define the + * namespace--optionally replacing an existing default declaration + * if present. + * + * 12.6.1. Set the ignore namespace definition attribute flag to true. + * 12.6.2. Append to qualified name the value of node's localName. + * 12.6.3. Let the value of inherited ns be ns. + * + * _Note:_ The new default namespace will be used in the serialization + * to define this node's namespace and act as the context namespace for + * its children. + */ + ignoreNamespaceDefinitionAttribute = true; + qualifiedName += node.localName; + inheritedNS = ns; + /** + * 12.6.4. Append the value of qualified name to markup. + */ + markup += qualifiedName; + /** + * 12.6.5. Append the following to markup, in the order listed: + * + * _Note:_ The following serializes the new (or replacement) default + * namespace definition. + * + * 12.6.5.1. " " (U+0020 SPACE); + * 12.6.5.2. The string "xmlns"; + * 12.6.5.3. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 12.6.5.4. The result of serializing an attribute value given ns + * and the require well-formed flag as input; + * 12.6.5.5. """ (U+0022 QUOTATION MARK). + */ + markup += " xmlns" + "=\"" + + this._serializeAttributeValue(ns, requireWellFormed) + "\""; + /** + * 12.7. Otherwise, the node has a local default namespace that matches + * ns. Append to qualified name the value of node's localName, let the + * value of inherited ns be ns, and append the value of qualified name + * to markup. + */ + } + else { + qualifiedName += node.localName; + inheritedNS = ns; + markup += qualifiedName; + } + } + /** + * 13. Append to markup the result of the XML serialization of node's + * attributes given map, prefix index, local prefixes map, ignore namespace + * definition attribute flag, and require well-formed flag. + */ + markup += this._serializeAttributesNS(node, map, prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, requireWellFormed); + /** + * 14. If ns is the HTML namespace, and the node's list of children is + * empty, and the node's localName matches any one of the following void + * elements: "area", "base", "basefont", "bgsound", "br", "col", "embed", + * "frame", "hr", "img", "input", "keygen", "link", "menuitem", "meta", + * "param", "source", "track", "wbr"; then append the following to markup, + * in the order listed: + * 14.1. " " (U+0020 SPACE); + * 14.2. "/" (U+002F SOLIDUS). + * and set the skip end tag flag to true. + * 15. If ns is not the HTML namespace, and the node's list of children is + * empty, then append "/" (U+002F SOLIDUS) to markup and set the skip end + * tag flag to true. + * 16. Append ">" (U+003E GREATER-THAN SIGN) to markup. + */ + var isHTML = (ns === infra_1.namespace.HTML); + if (isHTML && node.childNodes.length === 0 && + XMLSerializerImpl._VoidElementNames.has(node.localName)) { + markup += " /"; + skipEndTag = true; + } + else if (!isHTML && node.childNodes.length === 0) { + markup += "/"; + skipEndTag = true; + } + markup += ">"; + /** + * 17. If the value of skip end tag is true, then return the value of markup + * and skip the remaining steps. The node is a leaf-node. + */ + if (skipEndTag) + return markup; + /** + * 18. If ns is the HTML namespace, and the node's localName matches the + * string "template", then this is a template element. Append to markup the + * result of XML serializing a DocumentFragment node given the template + * element's template contents (a DocumentFragment), providing inherited + * ns, map, prefix index, and the require well-formed flag. + * + * _Note:_ This allows template content to round-trip, given the rules for + * parsing XHTML documents. + * + * 19. Otherwise, append to markup the result of running the XML + * serialization algorithm on each of node's children, in tree order, + * providing inherited ns, map, prefix index, and the require well-formed + * flag. + */ + if (isHTML && node.localName === "template") { + // TODO: serialize template contents + } + else { + try { + for (var _b = __values(node._children || node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) { + var childNode = _c.value; + markup += this._serializeNodeNS(childNode, inheritedNS, map, prefixIndex, requireWellFormed); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + } + /** + * 20. Append the following to markup, in the order listed: + * 20.1. "" (U+003E GREATER-THAN SIGN). + */ + markup += ""; + /** + * 21. Return the value of markup. + */ + return markup; + }; + /** + * Produces an XML serialization of a document node. + * + * @param node - node to serialize + * @param namespace - context namespace + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeDocumentNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed) { + var e_2, _a; + /** + * If the require well-formed flag is set (its value is true), and this node + * has no documentElement (the documentElement attribute's value is null), + * then throw an exception; the serialization of this node would not be a + * well-formed document. + */ + if (requireWellFormed && node.documentElement === null) { + throw new Error("Missing document element (well-formed required)."); + } + /** + * Otherwise, run the following steps: + * 1. Let serialized document be an empty string. + * 2. For each child child of node, in tree order, run the XML + * serialization algorithm on the child passing along the provided + * arguments, and append the result to serialized document. + * + * _Note:_ This will serialize any number of ProcessingInstruction and + * Comment nodes both before and after the Document's documentElement node, + * including at most one DocumentType node. (Text nodes are not allowed as + * children of the Document.) + * + * 3. Return the value of serialized document. + */ + var serializedDocument = ""; + try { + for (var _b = __values(node._children || node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) { + var childNode = _c.value; + serializedDocument += this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_2) throw e_2.error; } + } + return serializedDocument; + }; + /** + * Produces an XML serialization of a comment node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeComment = function (node, requireWellFormed) { + /** + * If the require well-formed flag is set (its value is true), and node's + * data contains characters that are not matched by the XML Char production + * or contains "--" (two adjacent U+002D HYPHEN-MINUS characters) or that + * ends with a "-" (U+002D HYPHEN-MINUS) character, then throw an exception; + * the serialization of this node's data would not be well-formed. + */ + if (requireWellFormed && (!algorithm_1.xml_isLegalChar(node.data) || + node.data.indexOf("--") !== -1 || node.data.endsWith("-"))) { + throw new Error("Comment data contains invalid characters (well-formed required)."); + } + /** + * Otherwise, return the concatenation of "". + */ + return ""; + }; + /** + * Produces an XML serialization of a text node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + * @param level - current depth of the XML tree + */ + XMLSerializerImpl.prototype._serializeText = function (node, requireWellFormed) { + /** + * 1. If the require well-formed flag is set (its value is true), and + * node's data contains characters that are not matched by the XML Char + * production, then throw an exception; the serialization of this node's + * data would not be well-formed. + */ + if (requireWellFormed && !algorithm_1.xml_isLegalChar(node.data)) { + throw new Error("Text data contains invalid characters (well-formed required)."); + } + /** + * 2. Let markup be the value of node's data. + * 3. Replace any occurrences of "&" in markup by "&". + * 4. Replace any occurrences of "<" in markup by "<". + * 5. Replace any occurrences of ">" in markup by ">". + * 6. Return the value of markup. + */ + var result = ""; + for (var i = 0; i < node.data.length; i++) { + var c = node.data[i]; + if (c === "&") + result += "&"; + else if (c === "<") + result += "<"; + else if (c === ">") + result += ">"; + else + result += c; + } + return result; + }; + /** + * Produces an XML serialization of a document fragment node. + * + * @param node - node to serialize + * @param namespace - context namespace + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeDocumentFragmentNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed) { + var e_3, _a; + /** + * 1. Let markup the empty string. + * 2. For each child child of node, in tree order, run the XML serialization + * algorithm on the child given namespace, prefix map, a reference to prefix + * index, and flag require well-formed. Concatenate the result to markup. + * 3. Return the value of markup. + */ + var markup = ""; + try { + for (var _b = __values(node._children || node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) { + var childNode = _c.value; + markup += this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed); + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_3) throw e_3.error; } + } + return markup; + }; + /** + * Produces an XML serialization of a document type node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeDocumentType = function (node, requireWellFormed) { + /** + * 1. If the require well-formed flag is true and the node's publicId + * attribute contains characters that are not matched by the XML PubidChar + * production, then throw an exception; the serialization of this node + * would not be a well-formed document type declaration. + */ + if (requireWellFormed && !algorithm_1.xml_isPubidChar(node.publicId)) { + throw new Error("DocType public identifier does not match PubidChar construct (well-formed required)."); + } + /** + * 2. If the require well-formed flag is true and the node's systemId + * attribute contains characters that are not matched by the XML Char + * production or that contains both a """ (U+0022 QUOTATION MARK) and a + * "'" (U+0027 APOSTROPHE), then throw an exception; the serialization + * of this node would not be a well-formed document type declaration. + */ + if (requireWellFormed && + (!algorithm_1.xml_isLegalChar(node.systemId) || + (node.systemId.indexOf('"') !== -1 && node.systemId.indexOf("'") !== -1))) { + throw new Error("DocType system identifier contains invalid characters (well-formed required)."); + } + /** + * 3. Let markup be an empty string. + * 4. Append the string "" (U+003E GREATER-THAN SIGN) to markup. + * 11. Return the value of markup. + */ + return node.publicId && node.systemId ? + "" + : node.publicId ? + "" + : node.systemId ? + "" + : + ""; + }; + /** + * Produces an XML serialization of a processing instruction node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeProcessingInstruction = function (node, requireWellFormed) { + /** + * 1. If the require well-formed flag is set (its value is true), and node's + * target contains a ":" (U+003A COLON) character or is an ASCII + * case-insensitive match for the string "xml", then throw an exception; + * the serialization of this node's target would not be well-formed. + */ + if (requireWellFormed && (node.target.indexOf(":") !== -1 || (/^xml$/i).test(node.target))) { + throw new Error("Processing instruction target contains invalid characters (well-formed required)."); + } + /** + * 2. If the require well-formed flag is set (its value is true), and node's + * data contains characters that are not matched by the XML Char production + * or contains the string "?>" (U+003F QUESTION MARK, + * U+003E GREATER-THAN SIGN), then throw an exception; the serialization of + * this node's data would not be well-formed. + */ + if (requireWellFormed && (!algorithm_1.xml_isLegalChar(node.data) || + node.data.indexOf("?>") !== -1)) { + throw new Error("Processing instruction data contains invalid characters (well-formed required)."); + } + /** + * 3. Let markup be the concatenation of the following, in the order listed: + * 3.1. "" (U+003F QUESTION MARK, U+003E GREATER-THAN SIGN). + * 4. Return the value of markup. + */ + return ""; + }; + /** + * Produces an XML serialization of a CDATA node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeCData = function (node, requireWellFormed) { + if (requireWellFormed && (node.data.indexOf("]]>") !== -1)) { + throw new Error("CDATA contains invalid characters (well-formed required)."); + } + return ""; + }; + /** + * Produces an XML serialization of the attributes of an element node. + * + * @param node - node to serialize + * @param map - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param localPrefixesMap - local prefixes map + * @param ignoreNamespaceDefinitionAttribute - whether to ignore namespace + * attributes + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeAttributesNS = function (node, map, prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, requireWellFormed) { + var e_4, _a; + /** + * 1. Let result be the empty string. + * 2. Let localname set be a new empty namespace localname set. This + * localname set will contain tuples of unique attribute namespaceURI and + * localName pairs, and is populated as each attr is processed. This set is + * used to [optionally] enforce the well-formed constraint that an element + * cannot have two attributes with the same namespaceURI and localName. + * This can occur when two otherwise identical attributes on the same + * element differ only by their prefix values. + */ + var result = ""; + var localNameSet = requireWellFormed ? new LocalNameSet_1.LocalNameSet() : undefined; + try { + /** + * 3. Loop: For each attribute attr in element's attributes, in the order + * they are specified in the element's attribute list: + */ + for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { + var attr = _c.value; + // Optimize common case + if (!ignoreNamespaceDefinitionAttribute && !requireWellFormed && attr.namespaceURI === null) { + result += " " + attr.localName + "=\"" + + this._serializeAttributeValue(attr.value, requireWellFormed) + "\""; + continue; + } + /** + * 3.1. If the require well-formed flag is set (its value is true), and the + * localname set contains a tuple whose values match those of a new tuple + * consisting of attr's namespaceURI attribute and localName attribute, + * then throw an exception; the serialization of this attr would fail to + * produce a well-formed element serialization. + */ + if (requireWellFormed && localNameSet && localNameSet.has(attr.namespaceURI, attr.localName)) { + throw new Error("Element contains duplicate attributes (well-formed required)."); + } + /** + * 3.2. Create a new tuple consisting of attr's namespaceURI attribute and + * localName attribute, and add it to the localname set. + * 3.3. Let attribute namespace be the value of attr's namespaceURI value. + * 3.4. Let candidate prefix be null. + */ + if (requireWellFormed && localNameSet) + localNameSet.set(attr.namespaceURI, attr.localName); + var attributeNamespace = attr.namespaceURI; + var candidatePrefix = null; + /** 3.5. If attribute namespace is not null, then run these sub-steps: */ + if (attributeNamespace !== null) { + /** + * 3.5.1. Let candidate prefix be the result of retrieving a preferred + * prefix string from map given namespace attribute namespace with + * preferred prefix being attr's prefix value. + */ + candidatePrefix = map.get(attr.prefix, attributeNamespace); + /** + * 3.5.2. If the value of attribute namespace is the XMLNS namespace, + * then run these steps: + */ + if (attributeNamespace === infra_1.namespace.XMLNS) { + /** + * 3.5.2.1. If any of the following are true, then stop running these + * steps and goto Loop to visit the next attribute: + * - the attr's value is the XML namespace; + * _Note:_ The XML namespace cannot be redeclared and survive + * round-tripping (unless it defines the prefix "xml"). To avoid this + * problem, this algorithm always prefixes elements in the XML + * namespace with "xml" and drops any related definitions as seen + * in the above condition. + * - the attr's prefix is null and the ignore namespace definition + * attribute flag is true (the Element's default namespace attribute + * should be skipped); + * - the attr's prefix is not null and either + * * the attr's localName is not a key contained in the local + * prefixes map, or + * * the attr's localName is present in the local prefixes map but + * the value of the key does not match attr's value + * and furthermore that the attr's localName (as the prefix to find) + * is found in the namespace prefix map given the namespace consisting + * of the attr's value (the current namespace prefix definition was + * exactly defined previously--on an ancestor element not the current + * element whose attributes are being processed). + */ + if (attr.value === infra_1.namespace.XML || + (attr.prefix === null && ignoreNamespaceDefinitionAttribute) || + (attr.prefix !== null && (!(attr.localName in localPrefixesMap) || + localPrefixesMap[attr.localName] !== attr.value) && + map.has(attr.localName, attr.value))) + continue; + /** + * 3.5.2.2. If the require well-formed flag is set (its value is true), + * and the value of attr's value attribute matches the XMLNS + * namespace, then throw an exception; the serialization of this + * attribute would produce invalid XML because the XMLNS namespace + * is reserved and cannot be applied as an element's namespace via + * XML parsing. + * + * _Note:_ DOM APIs do allow creation of elements in the XMLNS + * namespace but with strict qualifications. + */ + if (requireWellFormed && attr.value === infra_1.namespace.XMLNS) { + throw new Error("XMLNS namespace is reserved (well-formed required)."); + } + /** + * 3.5.2.3. If the require well-formed flag is set (its value is true), + * and the value of attr's value attribute is the empty string, then + * throw an exception; namespace prefix declarations cannot be used + * to undeclare a namespace (use a default namespace declaration + * instead). + */ + if (requireWellFormed && attr.value === '') { + throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."); + } + /** + * 3.5.2.4. the attr's prefix matches the string "xmlns", then let + * candidate prefix be the string "xmlns". + */ + if (attr.prefix === 'xmlns') + candidatePrefix = 'xmlns'; + /** + * 3.5.3. Otherwise, the attribute namespace is not the XMLNS namespace. + * Run these steps: + * + * _Note:_ The (candidatePrefix === null) check is not in the spec. + * We deviate from the spec here. Otherwise a prefix is generated for + * all attributes with namespaces. + */ + } + else if (candidatePrefix === null) { + if (attr.prefix !== null && + (!map.hasPrefix(attr.prefix) || + map.has(attr.prefix, attributeNamespace))) { + /** + * Check if we can use the attribute's own prefix. + * We deviate from the spec here. + * TODO: This is not an efficient way of searching for prefixes. + * Follow developments to the spec. + */ + candidatePrefix = attr.prefix; + } + else { + /** + * 3.5.3.1. Let candidate prefix be the result of generating a prefix + * providing map, attribute namespace, and prefix index as input. + */ + candidatePrefix = this._generatePrefix(attributeNamespace, map, prefixIndex); + } + /** + * 3.5.3.2. Append the following to result, in the order listed: + * 3.5.3.2.1. " " (U+0020 SPACE); + * 3.5.3.2.2. The string "xmlns:"; + * 3.5.3.2.3. The value of candidate prefix; + * 3.5.3.2.4. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 3.5.3.2.5. The result of serializing an attribute value given + * attribute namespace and the require well-formed flag as input; + * 3.5.3.2.6. """ (U+0022 QUOTATION MARK). + */ + result += " xmlns:" + candidatePrefix + "=\"" + + this._serializeAttributeValue(attributeNamespace, requireWellFormed) + "\""; + } + } + /** + * 3.6. Append a " " (U+0020 SPACE) to result. + * 3.7. If candidate prefix is not null, then append to result the + * concatenation of candidate prefix with ":" (U+003A COLON). + */ + result += " "; + if (candidatePrefix !== null) { + result += candidatePrefix + ':'; + } + /** + * 3.8. If the require well-formed flag is set (its value is true), and + * this attr's localName attribute contains the character + * ":" (U+003A COLON) or does not match the XML Name production or + * equals "xmlns" and attribute namespace is null, then throw an + * exception; the serialization of this attr would not be a + * well-formed attribute. + */ + if (requireWellFormed && (attr.localName.indexOf(":") !== -1 || + !algorithm_1.xml_isName(attr.localName) || + (attr.localName === "xmlns" && attributeNamespace === null))) { + throw new Error("Attribute local name contains invalid characters (well-formed required)."); + } + /** + * 3.9. Append the following strings to result, in the order listed: + * 3.9.1. The value of attr's localName; + * 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 3.9.3. The result of serializing an attribute value given attr's value + * attribute and the require well-formed flag as input; + * 3.9.4. """ (U+0022 QUOTATION MARK). + */ + result += attr.localName + "=\"" + + this._serializeAttributeValue(attr.value, requireWellFormed) + "\""; + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_4) throw e_4.error; } + } + /** + * 4. Return the value of result. + */ + return result; + }; + /** + * Records namespace information for the given element and returns the + * default namespace attribute value. + * + * @param node - element node to process + * @param map - namespace prefix map + * @param localPrefixesMap - local prefixes map + */ + XMLSerializerImpl.prototype._recordNamespaceInformation = function (node, map, localPrefixesMap) { + var e_5, _a; + /** + * 1. Let default namespace attr value be null. + */ + var defaultNamespaceAttrValue = null; + try { + /** + * 2. Main: For each attribute attr in element's attributes, in the order + * they are specified in the element's attribute list: + */ + for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { + var attr = _c.value; + /** + * _Note:_ The following conditional steps find namespace prefixes. Only + * attributes in the XMLNS namespace are considered (e.g., attributes made + * to look like namespace declarations via + * setAttribute("xmlns:pretend-prefix", "pretend-namespace") are not + * included). + */ + /** 2.1. Let attribute namespace be the value of attr's namespaceURI value. */ + var attributeNamespace = attr.namespaceURI; + /** 2.2. Let attribute prefix be the value of attr's prefix. */ + var attributePrefix = attr.prefix; + /** 2.3. If the attribute namespace is the XMLNS namespace, then: */ + if (attributeNamespace === infra_1.namespace.XMLNS) { + /** + * 2.3.1. If attribute prefix is null, then attr is a default namespace + * declaration. Set the default namespace attr value to attr's value and + * stop running these steps, returning to Main to visit the next + * attribute. + */ + if (attributePrefix === null) { + defaultNamespaceAttrValue = attr.value; + continue; + /** + * 2.3.2. Otherwise, the attribute prefix is not null and attr is a + * namespace prefix definition. Run the following steps: + */ + } + else { + /** 2.3.2.1. Let prefix definition be the value of attr's localName. */ + var prefixDefinition = attr.localName; + /** 2.3.2.2. Let namespace definition be the value of attr's value. */ + var namespaceDefinition = attr.value; + /** + * 2.3.2.3. If namespace definition is the XML namespace, then stop + * running these steps, and return to Main to visit the next + * attribute. + * + * _Note:_ XML namespace definitions in prefixes are completely + * ignored (in order to avoid unnecessary work when there might be + * prefix conflicts). XML namespaced elements are always handled + * uniformly by prefixing (and overriding if necessary) the element's + * localname with the reserved "xml" prefix. + */ + if (namespaceDefinition === infra_1.namespace.XML) { + continue; + } + /** + * 2.3.2.4. If namespace definition is the empty string (the + * declarative form of having no namespace), then let namespace + * definition be null instead. + */ + if (namespaceDefinition === '') { + namespaceDefinition = null; + } + /** + * 2.3.2.5. If prefix definition is found in map given the namespace + * namespace definition, then stop running these steps, and return to + * Main to visit the next attribute. + * + * _Note:_ This step avoids adding duplicate prefix definitions for + * the same namespace in the map. This has the side-effect of avoiding + * later serialization of duplicate namespace prefix declarations in + * any descendant nodes. + */ + if (map.has(prefixDefinition, namespaceDefinition)) { + continue; + } + /** + * 2.3.2.6. Add the prefix prefix definition to map given namespace + * namespace definition. + */ + map.set(prefixDefinition, namespaceDefinition); + /** + * 2.3.2.7. Add the value of prefix definition as a new key to the + * local prefixes map, with the namespace definition as the key's + * value replacing the value of null with the empty string if + * applicable. + */ + localPrefixesMap[prefixDefinition] = namespaceDefinition || ''; + } + } + } + } + catch (e_5_1) { e_5 = { error: e_5_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_5) throw e_5.error; } + } + /** + * 3. Return the value of default namespace attr value. + * + * _Note:_ The empty string is a legitimate return value and is not + * converted to null. + */ + return defaultNamespaceAttrValue; + }; + /** + * Generates a new prefix for the given namespace. + * + * @param newNamespace - a namespace to generate prefix for + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + */ + XMLSerializerImpl.prototype._generatePrefix = function (newNamespace, prefixMap, prefixIndex) { + /** + * 1. Let generated prefix be the concatenation of the string "ns" and the + * current numerical value of prefix index. + * 2. Let the value of prefix index be incremented by one. + * 3. Add to map the generated prefix given the new namespace namespace. + * 4. Return the value of generated prefix. + */ + var generatedPrefix = "ns" + prefixIndex.value; + prefixIndex.value++; + prefixMap.set(generatedPrefix, newNamespace); + return generatedPrefix; + }; + /** + * Produces an XML serialization of an attribute value. + * + * @param value - attribute value + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeAttributeValue = function (value, requireWellFormed) { + /** + * From: https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value + * + * 1. If the require well-formed flag is set (its value is true), and + * attribute value contains characters that are not matched by the XML Char + * production, then throw an exception; the serialization of this attribute + * value would fail to produce a well-formed element serialization. + */ + if (requireWellFormed && value !== null && !algorithm_1.xml_isLegalChar(value)) { + throw new Error("Invalid characters in attribute value."); + } + /** + * 2. If attribute value is null, then return the empty string. + */ + if (value === null) + return ""; + /** + * 3. Otherwise, attribute value is a string. Return the value of attribute + * value, first replacing any occurrences of the following: + * - "&" with "&" + * - """ with """ + * - "<" with "<" + * - ">" with ">" + * NOTE + * This matches behavior present in browsers, and goes above and beyond the + * grammar requirement in the XML specification's AttValue production by + * also replacing ">" characters. + */ + var result = ""; + for (var i = 0; i < value.length; i++) { + var c = value[i]; + if (c === "\"") + result += """; + else if (c === "&") + result += "&"; + else if (c === "<") + result += "<"; + else if (c === ">") + result += ">"; + else + result += c; + } + return result; + }; + /** + * Produces an XML serialization of an element node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeElement = function (node, requireWellFormed) { + var e_6, _a; + /** + * From: https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node + * + * 1. If the require well-formed flag is set (its value is true), and this + * node's localName attribute contains the character ":" (U+003A COLON) or + * does not match the XML Name production, then throw an exception; the + * serialization of this node would not be a well-formed element. + */ + if (requireWellFormed && (node.localName.indexOf(":") !== -1 || + !algorithm_1.xml_isName(node.localName))) { + throw new Error("Node local name contains invalid characters (well-formed required)."); + } + /** + * 2. Let markup be the string "<" (U+003C LESS-THAN SIGN). + * 3. Let qualified name be an empty string. + * 4. Let skip end tag be a boolean flag with value false. + * 5. Let ignore namespace definition attribute be a boolean flag with value + * false. + * 6. Given prefix map, copy a namespace prefix map and let map be the + * result. + * 7. Let local prefixes map be an empty map. The map has unique Node prefix + * strings as its keys, with corresponding namespaceURI Node values as the + * map's key values (in this map, the null namespace is represented by the + * empty string). + * + * _Note:_ This map is local to each element. It is used to ensure there + * are no conflicting prefixes should a new namespace prefix attribute need + * to be generated. It is also used to enable skipping of duplicate prefix + * definitions when writing an element's attributes: the map allows the + * algorithm to distinguish between a prefix in the namespace prefix map + * that might be locally-defined (to the current Element) and one that is + * not. + * 8. Let local default namespace be the result of recording the namespace + * information for node given map and local prefixes map. + * + * _Note:_ The above step will update map with any found namespace prefix + * definitions, add the found prefix definitions to the local prefixes map + * and return a local default namespace value defined by a default namespace + * attribute if one exists. Otherwise it returns null. + * 9. Let inherited ns be a copy of namespace. + * 10. Let ns be the value of node's namespaceURI attribute. + */ + var skipEndTag = false; + /** 11. If inherited ns is equal to ns, then: */ + /** + * 11.1. If local default namespace is not null, then set ignore + * namespace definition attribute to true. + * 11.2. If ns is the XML namespace, then append to qualified name the + * concatenation of the string "xml:" and the value of node's localName. + * 11.3. Otherwise, append to qualified name the value of node's + * localName. The node's prefix if it exists, is dropped. + */ + var qualifiedName = node.localName; + /** 11.4. Append the value of qualified name to markup. */ + var markup = "<" + qualifiedName; + /** + * 13. Append to markup the result of the XML serialization of node's + * attributes given map, prefix index, local prefixes map, ignore namespace + * definition attribute flag, and require well-formed flag. + */ + markup += this._serializeAttributes(node, requireWellFormed); + /** + * 14. If ns is the HTML namespace, and the node's list of children is + * empty, and the node's localName matches any one of the following void + * elements: "area", "base", "basefont", "bgsound", "br", "col", "embed", + * "frame", "hr", "img", "input", "keygen", "link", "menuitem", "meta", + * "param", "source", "track", "wbr"; then append the following to markup, + * in the order listed: + * 14.1. " " (U+0020 SPACE); + * 14.2. "/" (U+002F SOLIDUS). + * and set the skip end tag flag to true. + * 15. If ns is not the HTML namespace, and the node's list of children is + * empty, then append "/" (U+002F SOLIDUS) to markup and set the skip end + * tag flag to true. + * 16. Append ">" (U+003E GREATER-THAN SIGN) to markup. + */ + if (node._children.size === 0) { + markup += "/"; + skipEndTag = true; + } + markup += ">"; + /** + * 17. If the value of skip end tag is true, then return the value of markup + * and skip the remaining steps. The node is a leaf-node. + */ + if (skipEndTag) + return markup; + try { + /** + * 18. If ns is the HTML namespace, and the node's localName matches the + * string "template", then this is a template element. Append to markup the + * result of XML serializing a DocumentFragment node given the template + * element's template contents (a DocumentFragment), providing inherited + * ns, map, prefix index, and the require well-formed flag. + * + * _Note:_ This allows template content to round-trip, given the rules for + * parsing XHTML documents. + * + * 19. Otherwise, append to markup the result of running the XML + * serialization algorithm on each of node's children, in tree order, + * providing inherited ns, map, prefix index, and the require well-formed + * flag. + */ + for (var _b = __values(node._children), _c = _b.next(); !_c.done; _c = _b.next()) { + var childNode = _c.value; + markup += this._serializeNode(childNode, requireWellFormed); + } + } + catch (e_6_1) { e_6 = { error: e_6_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_6) throw e_6.error; } + } + /** + * 20. Append the following to markup, in the order listed: + * 20.1. "" (U+003E GREATER-THAN SIGN). + */ + markup += ""; + /** + * 21. Return the value of markup. + */ + return markup; + }; + /** + * Produces an XML serialization of a document node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeDocument = function (node, requireWellFormed) { + var e_7, _a; + /** + * If the require well-formed flag is set (its value is true), and this node + * has no documentElement (the documentElement attribute's value is null), + * then throw an exception; the serialization of this node would not be a + * well-formed document. + */ + if (requireWellFormed && node.documentElement === null) { + throw new Error("Missing document element (well-formed required)."); + } + /** + * Otherwise, run the following steps: + * 1. Let serialized document be an empty string. + * 2. For each child child of node, in tree order, run the XML + * serialization algorithm on the child passing along the provided + * arguments, and append the result to serialized document. + * + * _Note:_ This will serialize any number of ProcessingInstruction and + * Comment nodes both before and after the Document's documentElement node, + * including at most one DocumentType node. (Text nodes are not allowed as + * children of the Document.) + * + * 3. Return the value of serialized document. + */ + var serializedDocument = ""; + try { + for (var _b = __values(node._children), _c = _b.next(); !_c.done; _c = _b.next()) { + var childNode = _c.value; + serializedDocument += this._serializeNode(childNode, requireWellFormed); + } + } + catch (e_7_1) { e_7 = { error: e_7_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_7) throw e_7.error; } + } + return serializedDocument; + }; + /** + * Produces an XML serialization of a document fragment node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeDocumentFragment = function (node, requireWellFormed) { + var e_8, _a; + /** + * 1. Let markup the empty string. + * 2. For each child child of node, in tree order, run the XML serialization + * algorithm on the child given namespace, prefix map, a reference to prefix + * index, and flag require well-formed. Concatenate the result to markup. + * 3. Return the value of markup. + */ + var markup = ""; + try { + for (var _b = __values(node._children), _c = _b.next(); !_c.done; _c = _b.next()) { + var childNode = _c.value; + markup += this._serializeNode(childNode, requireWellFormed); + } + } + catch (e_8_1) { e_8 = { error: e_8_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_8) throw e_8.error; } + } + return markup; + }; + /** + * Produces an XML serialization of the attributes of an element node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + XMLSerializerImpl.prototype._serializeAttributes = function (node, requireWellFormed) { + var e_9, _a; + /** + * 1. Let result be the empty string. + * 2. Let localname set be a new empty namespace localname set. This + * localname set will contain tuples of unique attribute namespaceURI and + * localName pairs, and is populated as each attr is processed. This set is + * used to [optionally] enforce the well-formed constraint that an element + * cannot have two attributes with the same namespaceURI and localName. + * This can occur when two otherwise identical attributes on the same + * element differ only by their prefix values. + */ + var result = ""; + var localNameSet = requireWellFormed ? {} : undefined; + try { + /** + * 3. Loop: For each attribute attr in element's attributes, in the order + * they are specified in the element's attribute list: + */ + for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { + var attr = _c.value; + /** + * 3.1. If the require well-formed flag is set (its value is true), and the + * localname set contains a tuple whose values match those of a new tuple + * consisting of attr's namespaceURI attribute and localName attribute, + * then throw an exception; the serialization of this attr would fail to + * produce a well-formed element serialization. + */ + if (requireWellFormed && localNameSet && (attr.localName in localNameSet)) { + throw new Error("Element contains duplicate attributes (well-formed required)."); + } + /** + * 3.2. Create a new tuple consisting of attr's namespaceURI attribute and + * localName attribute, and add it to the localname set. + * 3.3. Let attribute namespace be the value of attr's namespaceURI value. + * 3.4. Let candidate prefix be null. + */ + if (requireWellFormed && localNameSet) + localNameSet[attr.localName] = true; + /** 3.5. If attribute namespace is not null, then run these sub-steps: */ + /** + * 3.6. Append a " " (U+0020 SPACE) to result. + * 3.7. If candidate prefix is not null, then append to result the + * concatenation of candidate prefix with ":" (U+003A COLON). + */ + /** + * 3.8. If the require well-formed flag is set (its value is true), and + * this attr's localName attribute contains the character + * ":" (U+003A COLON) or does not match the XML Name production or + * equals "xmlns" and attribute namespace is null, then throw an + * exception; the serialization of this attr would not be a + * well-formed attribute. + */ + if (requireWellFormed && (attr.localName.indexOf(":") !== -1 || + !algorithm_1.xml_isName(attr.localName))) { + throw new Error("Attribute local name contains invalid characters (well-formed required)."); + } + /** + * 3.9. Append the following strings to result, in the order listed: + * 3.9.1. The value of attr's localName; + * 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 3.9.3. The result of serializing an attribute value given attr's value + * attribute and the require well-formed flag as input; + * 3.9.4. """ (U+0022 QUOTATION MARK). + */ + result += " " + attr.localName + "=\"" + + this._serializeAttributeValue(attr.value, requireWellFormed) + "\""; + } + } + catch (e_9_1) { e_9 = { error: e_9_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_9) throw e_9.error; } + } + /** + * 4. Return the value of result. + */ + return result; + }; + XMLSerializerImpl._VoidElementNames = new Set(['area', 'base', 'basefont', + 'bgsound', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'keygen', + 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']); + return XMLSerializerImpl; +}()); +exports.XMLSerializerImpl = XMLSerializerImpl; +//# sourceMappingURL=XMLSerializerImpl.js.map \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl.js.map b/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl.js.map new file mode 100644 index 0000000..cb0c60a --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"XMLSerializerImpl.js","sourceRoot":"","sources":["../../src/serializer/XMLSerializerImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,gDAG0B;AAC1B,+CAA6C;AAC7C,2DAAyD;AACzD,oDAAuD;AACvD,yCAA6D;AAC7D,0CAA2E;AAS3E;;;;GAIG;AACH;IAAA;IA87CA,CAAC;IAx7CC,kBAAkB;IAClB,6CAAiB,GAAjB,UAAkB,IAAU;QAC1B;;;;WAIG;QACH,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAC5C,CAAC;IAED;;;;;OAKG;IACK,6CAAiB,GAAzB,UAA0B,IAAU,EAAE,iBAA0B;QAC9D,wEAAwE;QACxE,mCAAmC;QACnC,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE;YACzE;;;;;;;;;;;;;;;eAeG;YACH,IAAM,SAAS,GAAkB,IAAI,CAAA;YACrC,IAAM,SAAS,GAAG,IAAI,uCAAkB,EAAE,CAAA;YAC1C,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,iBAAc,CAAC,GAAG,CAAC,CAAA;YACxC,IAAM,WAAW,GAAgB,EAAE,KAAK,EAAE,CAAC,EAAE,CAAA;YAE7C;;;;;;;eAOG;YACH,IAAI;gBACF,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAClE,iBAAiB,CAAC,CAAA;aACrB;YAAC,WAAM;gBACN,MAAM,IA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I,YAAY;oBAAE,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;gBAE1E,yEAAyE;gBACzE;;;;mBAIG;gBACH;;;;;;;mBAOG;gBACH,IAAI,iBAAiB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;oBAC1D,CAAC,sBAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE;oBAC9B,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAA;iBAC5F;gBAED;;;;;;;mBAOG;gBACH,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,GAAG,KAAK;oBACpC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,KAAK,EAAE,iBAAiB,CAAC,GAAG,IAAI,CAAA;aACtE;;;;;;;;;QAED;;WAEG;QACH,OAAO,MAAM,CAAA;IACf,CAAC;IA17Cc,mCAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU;QACpE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ;QACxE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;IA07CnE,wBAAC;CAAA,AA97CD,IA87CC;AA97CY,8CAAiB"} \ No newline at end of file diff --git a/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl2.d.ts b/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl2.d.ts new file mode 100644 index 0000000..292f85f --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl2.d.ts @@ -0,0 +1,2 @@ +import { Node } from "../dom/interfaces"; +export declare function serializeToString(root: Node): string; diff --git a/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl2.js b/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl2.js new file mode 100644 index 0000000..dfbc452 --- /dev/null +++ b/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl2.js @@ -0,0 +1,962 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var interfaces_1 = require("../dom/interfaces"); +var infra_1 = require("@oozcitak/infra"); +var algorithm_1 = require("../algorithm"); +var util_1 = require("../util"); +var AbsoluteURLs; +(function (AbsoluteURLs) { + AbsoluteURLs[AbsoluteURLs["kDoNotResolveURLs"] = 0] = "kDoNotResolveURLs"; + AbsoluteURLs[AbsoluteURLs["kResolveAllURLs"] = 1] = "kResolveAllURLs"; + AbsoluteURLs[AbsoluteURLs["kResolveNonLocalURLs"] = 2] = "kResolveNonLocalURLs"; +})(AbsoluteURLs || (AbsoluteURLs = {})); +var SerializationType; +(function (SerializationType) { + SerializationType[SerializationType["kHTML"] = 0] = "kHTML"; + SerializationType[SerializationType["kXML"] = 1] = "kXML"; +})(SerializationType || (SerializationType = {})); +var IncludeShadowRoots; +(function (IncludeShadowRoots) { + IncludeShadowRoots[IncludeShadowRoots["kNoShadowRoots"] = 0] = "kNoShadowRoots"; + IncludeShadowRoots[IncludeShadowRoots["kIncludeShadowRoots"] = 1] = "kIncludeShadowRoots"; +})(IncludeShadowRoots || (IncludeShadowRoots = {})); +var ChildrenOnly; +(function (ChildrenOnly) { + ChildrenOnly[ChildrenOnly["kIncludeNode"] = 0] = "kIncludeNode"; + ChildrenOnly[ChildrenOnly["kChildrenOnly"] = 1] = "kChildrenOnly"; +})(ChildrenOnly || (ChildrenOnly = {})); +var EntityMask; +(function (EntityMask) { + EntityMask[EntityMask["kEntityAmp"] = 1] = "kEntityAmp"; + EntityMask[EntityMask["kEntityLt"] = 2] = "kEntityLt"; + EntityMask[EntityMask["kEntityGt"] = 4] = "kEntityGt"; + EntityMask[EntityMask["kEntityQuot"] = 8] = "kEntityQuot"; + EntityMask[EntityMask["kEntityNbsp"] = 16] = "kEntityNbsp"; + EntityMask[EntityMask["kEntityTab"] = 32] = "kEntityTab"; + EntityMask[EntityMask["kEntityLineFeed"] = 64] = "kEntityLineFeed"; + EntityMask[EntityMask["kEntityCarriageReturn"] = 128] = "kEntityCarriageReturn"; + // Non-breaking space needs to be escaped in innerHTML for compatibility + // reasons. See http://trac.webkit.org/changeset/32879. However, we cannot do + // this in an XML document because it does not have the entity reference + // defined (see bug 19215). + EntityMask[EntityMask["kEntityMaskInCDATA"] = 0] = "kEntityMaskInCDATA"; + EntityMask[EntityMask["kEntityMaskInPCDATA"] = 7] = "kEntityMaskInPCDATA"; + EntityMask[EntityMask["kEntityMaskInHTMLPCDATA"] = 23] = "kEntityMaskInHTMLPCDATA"; + EntityMask[EntityMask["kEntityMaskInAttributeValue"] = 239] = "kEntityMaskInAttributeValue"; + EntityMask[EntityMask["kEntityMaskInHTMLAttributeValue"] = 25] = "kEntityMaskInHTMLAttributeValue"; +})(EntityMask || (EntityMask = {})); +; +function serializeToString(root) { + var accumulator = new MarkupAccumulator(AbsoluteURLs.kDoNotResolveURLs, SerializationType.kXML, IncludeShadowRoots.kNoShadowRoots); + return accumulator.SerializeNodes(root, ChildrenOnly.kIncludeNode); +} +exports.serializeToString = serializeToString; +function ElementCannotHaveEndTag(node) { + //auto* html_element = DynamicTo(node); + //if (!html_element) return false; + //return !html_element->ShouldSerializeEndTag(); + return false; +} +function EqualIgnoringNullity(a, b) { + if (a === null && b !== null && b.length === 0) + return true; + if (b === null && a !== null && a.length === 0) + return true; + return a === b; +} +var MarkupAccumulator = /** @class */ (function () { + function MarkupAccumulator(resolve_urls_method, serialization_type, include_shadow_roots_) { + this.include_shadow_roots_ = include_shadow_roots_; + this.markup_ = { str: "" }; + this.namespace_stack_ = []; + // https://w3c.github.io/DOM-Parsing/#dfn-generated-namespace-prefix-index + this.prefix_index_ = 1; + this.formatter_ = new MarkupFormatter(resolve_urls_method, serialization_type); + } + MarkupAccumulator.prototype.AppendEndTag = function (element, prefix) { + this.formatter_.AppendEndMarkup(this.markup_, element, prefix, element.localName); + }; + MarkupAccumulator.prototype.AppendStartMarkup = function (node) { + if (util_1.Guard.isTextNode(node)) { + this.formatter_.AppendText(this.markup_, node); + } + else if (util_1.Guard.isAttrNode(node)) { + // Only XMLSerializer can pass an Attr. So, |documentIsHTML| flag is + // false. + this.formatter_.AppendAttributeValue(this.markup_, node.value, false); + } + else { + this.formatter_.AppendStartMarkup(this.markup_, node); + } + }; + MarkupAccumulator.prototype.AppendCustomAttributes = function () { }; + MarkupAccumulator.prototype.ShouldIgnoreAttribute = function () { + return false; + }; + MarkupAccumulator.prototype.ShouldIgnoreElement = function () { + return false; + }; + MarkupAccumulator.prototype.AppendElement = function (element) { + var e_1, _a, e_2, _b; + var data = this.AppendStartTagOpen(element); + if (this.SerializeAsHTML()) { + // https://html.spec.whatwg.org/C/#html-fragment-serialisation-algorithm + var attributes = element.attributes; + // 3.2. Element: If current node's is value is not null, and the + // element does not have an is attribute in its attribute list, ... + var is_value = element._is; + if (is_value !== null && attributes.getNamedItem("is") === undefined) { + var isAttr = algorithm_1.create_attr(element._nodeDocument, "is"); + isAttr.value = is_value; + this.AppendAttribute(element, isAttr); + } + try { + for (var attributes_1 = __values(attributes), attributes_1_1 = attributes_1.next(); !attributes_1_1.done; attributes_1_1 = attributes_1.next()) { + var attribute = attributes_1_1.value; + if (!this.ShouldIgnoreAttribute()) + this.AppendAttribute(element, attribute); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (attributes_1_1 && !attributes_1_1.done && (_a = attributes_1.return)) _a.call(attributes_1); + } + finally { if (e_1) throw e_1.error; } + } + } + else { + try { + // https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node + for (var _c = __values(element.attributes), _d = _c.next(); !_d.done; _d = _c.next()) { + var attribute = _d.value; + if (data.ignore_namespace_definition_attribute_ && + attribute.namespaceURI == infra_1.namespace.XMLNS && + attribute.prefix === "") { + // Drop xmlns= only if it's inconsistent with element's namespace. + // https://github.com/w3c/DOM-Parsing/issues/47 + if (!EqualIgnoringNullity(attribute.value, element.namespaceURI)) + continue; + } + if (!this.ShouldIgnoreAttribute()) + this.AppendAttribute(element, attribute); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_d && !_d.done && (_b = _c.return)) _b.call(_c); + } + finally { if (e_2) throw e_2.error; } + } + } + // Give an opportunity to subclasses to add their own attributes. + this.AppendCustomAttributes(); + this.AppendStartTagClose(element); + return data.serialized_prefix_; + }; + MarkupAccumulator.prototype.AppendStartTagOpen = function (element) { + var data = new ElementSerializationData(); + data.serialized_prefix_ = element.prefix; + if (this.SerializeAsHTML()) { + this.formatter_.AppendStartTagOpen(this.markup_, element); + return data; + } + // https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node + var namespace_context = this.namespace_stack_[this.namespace_stack_.length - 1]; + if (namespace_context === undefined) { + throw new Error("namespace_context is undefined"); + } + // 5. Let ignore namespace definition attribute be a boolean flag with value + // false. + data.ignore_namespace_definition_attribute_ = false; + // 8. Let local default namespace be the result of recording the namespace + // information for node given map and local prefixes map. + var local_default_namespace = namespace_context.RecordNamespaceInformation(element); + // 9. Let inherited ns be a copy of namespace. + var inherited_ns = namespace_context.ContextNamespace(); + // 10. Let ns be the value of node's namespaceURI attribute. + var ns = element.namespaceURI; + // 11. If inherited ns is equal to ns, then: + if (inherited_ns == ns) { + // 11.1. If local default namespace is not null, then set ignore namespace + // definition attribute to true. + data.ignore_namespace_definition_attribute_ = local_default_namespace !== null; + // 11.3. Otherwise, append to qualified name the value of node's + // localName. The node's prefix if it exists, is dropped. + // 11.4. Append the value of qualified name to markup. + this.formatter_.AppendStartTagOpen(this.markup_, null, element.localName); + data.serialized_prefix_ = null; + return data; + } + // 12. Otherwise, inherited ns is not equal to ns (the node's own namespace is + // different from the context namespace of its parent). Run these sub-steps: + // 12.1. Let prefix be the value of node's prefix attribute. + var prefix = element.prefix; + // 12.2. Let candidate prefix be the result of retrieving a preferred prefix + // string prefix from map given namespace ns. + var candidate_prefix = null; + if (ns && (prefix || ns != local_default_namespace)) { + candidate_prefix = this.RetrievePreferredPrefixString(ns, prefix); + } + // 12.4. if candidate prefix is not null (a namespace prefix is defined which + // maps to ns), then: + if (candidate_prefix !== null && this.LookupNamespaceURI(candidate_prefix)) { + // 12.4.1. Append to qualified name the concatenation of candidate prefix, + // ":" (U+003A COLON), and node's localName. + // 12.4.3. Append the value of qualified name to markup. + this.formatter_.AppendStartTagOpen(this.markup_, candidate_prefix, element.localName); + data.serialized_prefix_ = candidate_prefix; + // 12.4.2. If the local default namespace is not null (there exists a + // locally-defined default namespace declaration attribute) and its value is + // not the XML namespace, then let inherited ns get the value of local + // default namespace unless the local default namespace is the empty string + // in which case let it get null (the context namespace is changed to the + // declared default, rather than this node's own namespace). + if (local_default_namespace != infra_1.namespace.XML) { + namespace_context.InheritLocalDefaultNamespace(local_default_namespace); + } + return data; + } + // 12.5. Otherwise, if prefix is not null, then: + if (prefix) { + // 12.5.1. If the local prefixes map contains a key matching prefix, then + // let prefix be the result of generating a prefix providing as input map, + // ns, and prefix index + if (element.hasAttribute("xmlns:" + prefix)) { + prefix = this.GeneratePrefix(ns); + } + else { + // 12.5.2. Add prefix to map given namespace ns. + this.AddPrefix(prefix, ns); + } + // 12.5.3. Append to qualified name the concatenation of prefix, ":" (U+003A + // COLON), and node's localName. + // 12.5.4. Append the value of qualified name to markup. + this.formatter_.AppendStartTagOpen(this.markup_, prefix, element.localName); + data.serialized_prefix_ = prefix; + // 12.5.5. Append the following to markup, in the order listed: + this.formatter_.AppendAttribute(this.markup_, "xmlns", prefix, ns || "", false); + // 12.5.5.7. If local default namespace is not null (there exists a + // locally-defined default namespace declaration attribute), then let + // inherited ns get the value of local default namespace unless the local + // default namespace is the empty string in which case let it get null. + namespace_context.InheritLocalDefaultNamespace(local_default_namespace); + return data; + } + // 12.6. Otherwise, if local default namespace is null, or local default + // namespace is not null and its value is not equal to ns, then: + if (local_default_namespace === null || + !EqualIgnoringNullity(local_default_namespace, ns)) { + // 12.6.1. Set the ignore namespace definition attribute flag to true. + data.ignore_namespace_definition_attribute_ = true; + // 12.6.3. Let the value of inherited ns be ns. + namespace_context.SetContextNamespace(ns); + // 12.6.4. Append the value of qualified name to markup. + this.formatter_.AppendStartTagOpen(this.markup_, element); + // 12.6.5. Append the following to markup, in the order listed: + this.formatter_.AppendAttribute(this.markup_, null, "xmlns", ns || "", false); + return data; + } + // 12.7. Otherwise, the node has a local default namespace that matches + // ns. Append to qualified name the value of node's localName, let the value + // of inherited ns be ns, and append the value of qualified name to markup. + console.assert(EqualIgnoringNullity(local_default_namespace, ns)); + namespace_context.SetContextNamespace(ns); + this.formatter_.AppendStartTagOpen(this.markup_, element); + return data; + }; + MarkupAccumulator.prototype.AppendStartTagClose = function (element) { + this.formatter_.AppendStartTagClose(this.markup_, element); + }; + MarkupAccumulator.prototype.AppendAttribute = function (element, attribute) { + var value = this.formatter_.ResolveURLIfNeeded(element, attribute); + if (this.SerializeAsHTML()) { + this.formatter_.AppendAttributeAsHTML(this.markup_, attribute, value); + } + else { + this.AppendAttributeAsXMLWithNamespace(attribute, value); + } + }; + MarkupAccumulator.prototype.AppendAttributeAsXMLWithNamespace = function (attribute, value) { + // https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes + // 3.3. Let attribute namespace be the value of attr's namespaceURI value. + var attribute_namespace = attribute.namespaceURI; + // 3.4. Let candidate prefix be null. + var candidate_prefix = null; + if (attribute_namespace === null) { + this.formatter_.AppendAttribute(this.markup_, candidate_prefix, attribute.localName, value, false); + return; + } + // 3.5. If attribute namespace is not null, then run these sub-steps: + // 3.5.1. Let candidate prefix be the result of retrieving a preferred + // prefix string from map given namespace attribute namespace with preferred + // prefix being attr's prefix value. + candidate_prefix = + this.RetrievePreferredPrefixString(attribute_namespace, attribute.prefix); + // 3.5.2. If the value of attribute namespace is the XMLNS namespace, then + // run these steps: + if (attribute_namespace == infra_1.namespace.XMLNS) { + if (!attribute.prefix && attribute.localName !== "xmlns") + candidate_prefix = "xmlns"; + } + else { + // 3.5.3. Otherwise, the attribute namespace in not the XMLNS namespace. + // Run these steps: + if (this.ShouldAddNamespaceAttribute(attribute, candidate_prefix)) { + if (!candidate_prefix || this.LookupNamespaceURI(candidate_prefix)) { + // 3.5.3.1. Let candidate prefix be the result of generating a prefix + // providing map, attribute namespace, and prefix index as input. + candidate_prefix = this.GeneratePrefix(attribute_namespace); + // 3.5.3.2. Append the following to result, in the order listed: + this.formatter_.AppendAttribute(this.markup_, "xmlns", candidate_prefix, attribute_namespace, false); + } + else { + this.AppendNamespace(candidate_prefix, attribute_namespace); + } + } + } + this.formatter_.AppendAttribute(this.markup_, candidate_prefix, attribute.localName, value, false); + }; + MarkupAccumulator.prototype.ShouldAddNamespaceAttribute = function (attribute, candidate_prefix) { + // xmlns and xmlns:prefix attributes should be handled by another branch in + // AppendAttributeAsXMLWithNamespace(). + console.assert(attribute.namespaceURI !== infra_1.namespace.XMLNS); + // Null namespace is checked earlier in AppendAttributeAsXMLWithNamespace(). + console.assert(attribute.namespaceURI); + // Attributes without a prefix will need one generated for them, and an xmlns + // attribute for that prefix. + if (!candidate_prefix) + return true; + return !EqualIgnoringNullity(this.LookupNamespaceURI(candidate_prefix), attribute.namespaceURI); + }; + MarkupAccumulator.prototype.AppendNamespace = function (prefix, namespace_uri) { + var found_uri = this.LookupNamespaceURI(prefix); + if (!EqualIgnoringNullity(found_uri, namespace_uri)) { + this.AddPrefix(prefix, namespace_uri); + if (!prefix) { + this.formatter_.AppendAttribute(this.markup_, null, "xmlns", namespace_uri, false); + } + else { + this.formatter_.AppendAttribute(this.markup_, "xmlns", prefix, namespace_uri, false); + } + } + }; + MarkupAccumulator.prototype.PushNamespaces = function () { + if (this.SerializeAsHTML()) + return; + console.assert(this.namespace_stack_.length > 0); + // TODO(tkent): Avoid to copy the whole map. + // We can't do |namespace_stack_.emplace_back(namespace_stack_.back())| + // because back() returns a reference in the vector backing, and + // emplace_back() can reallocate it. + this.namespace_stack_.push(this.namespace_stack_[this.namespace_stack_.length - 1].Clone()); + }; + MarkupAccumulator.prototype.PopNamespaces = function () { + if (this.SerializeAsHTML()) + return; + this.namespace_stack_.pop(); + }; + // https://w3c.github.io/DOM-Parsing/#dfn-retrieving-a-preferred-prefix-string + MarkupAccumulator.prototype.RetrievePreferredPrefixString = function (ns, preferred_prefix) { + var e_3, _a; + console.assert(ns); + var ns_for_preferred = this.LookupNamespaceURI(preferred_prefix); + // Preserve the prefix if the prefix is used in the scope and the namespace + // for it is matches to the node's one. + // This is equivalent to the following step in the specification: + // 2.1. If prefix matches preferred prefix, then stop running these steps and + // return prefix. + if (preferred_prefix && ns_for_preferred !== null && + EqualIgnoringNullity(ns_for_preferred, ns)) + return preferred_prefix; + var candidate_list = this.namespace_stack_[this.namespace_stack_.length - 1].PrefixList(ns); + try { + // Get the last effective prefix. + // + // + // + // el2.setAttributeNS(U1, 'n', 'v'); + // We should get 'p'. + // + // + // el1.setAttributeNS(U1, 'n', 'v'); + // We should not get '' for attributes. + for (var candidate_list_1 = __values(candidate_list), candidate_list_1_1 = candidate_list_1.next(); !candidate_list_1_1.done; candidate_list_1_1 = candidate_list_1.next()) { + var candidate_prefix = candidate_list_1_1.value; + console.assert(candidate_prefix); + var ns_for_candidate = this.LookupNamespaceURI(candidate_prefix); + if (EqualIgnoringNullity(ns_for_candidate, ns)) + return candidate_prefix; + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (candidate_list_1_1 && !candidate_list_1_1.done && (_a = candidate_list_1.return)) _a.call(candidate_list_1); + } + finally { if (e_3) throw e_3.error; } + } + // No prefixes for |ns|. + // Preserve the prefix if the prefix is not used in the current scope. + if (preferred_prefix && ns_for_preferred === null) + return preferred_prefix; + // If a prefix is not specified, or the prefix is mapped to a + // different namespace, we should generate new prefix. + return null; + }; + MarkupAccumulator.prototype.AddPrefix = function (prefix, namespace_uri) { + this.namespace_stack_[this.namespace_stack_.length - 1].Add(prefix, namespace_uri); + }; + MarkupAccumulator.prototype.LookupNamespaceURI = function (prefix) { + return this.namespace_stack_[this.namespace_stack_.length - 1].LookupNamespaceURI(prefix); + }; + // https://w3c.github.io/DOM-Parsing/#dfn-generating-a-prefix + MarkupAccumulator.prototype.GeneratePrefix = function (new_namespace) { + var generated_prefix = ""; + do { + // 1. Let generated prefix be the concatenation of the string "ns" and the + // current numerical value of prefix index. + generated_prefix = "ns" + this.prefix_index_.toString(); + // 2. Let the value of prefix index be incremented by one. + this.prefix_index_++; + } while (this.LookupNamespaceURI(generated_prefix)); + // 3. Add to map the generated prefix given the new namespace namespace. + this.AddPrefix(generated_prefix, new_namespace); + // 4. Return the value of generated prefix. + return generated_prefix; + }; + MarkupAccumulator.prototype.SerializeAsHTML = function () { + return this.formatter_.SerializeAsHTML(); + }; + MarkupAccumulator.prototype.GetAuxiliaryDOMTree = function (element) { + var shadow_root = element._shadowRoot; + if (!shadow_root || this.include_shadow_roots_ != IncludeShadowRoots.kIncludeShadowRoots) + return [null, null]; + var shadowroot_type = shadow_root._mode; + // Wrap the shadowroot into a declarative Shadow DOM