| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | |
| 4 * | |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | |
| 6 * it under the terms of the GNU General Public License version 3 as | |
| 7 * published by the Free Software Foundation. | |
| 8 * | |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 * GNU General Public License for more details. | |
| 13 * | |
| 14 * You should have received a copy of the GNU General Public License | |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
| 16 */ | |
| 17 | |
| 18 window.URL = (function() | |
| 19 { | |
| 20 let URL = window.URL || window.webkitURL; | |
| 21 let URLproperties = ["href", "protocol", "host", "hostname", "port", "pathname ", "search"]; | |
|
Wladimir Palant
2015/01/21 15:33:44
Nit: This isn't proper camel case, should be URLPr
Sebastian Noack
2015/01/21 17:48:18
Done.
| |
| 22 | |
| 23 if (!URL || !URLproperties.every(prop => prop in new URL(""))) | |
|
Wladimir Palant
2015/01/21 15:33:44
This will create seven URL instances, seems unnece
Sebastian Noack
2015/01/21 15:58:04
So what? This code runs only once, and an empty st
| |
| 24 { | |
| 25 let doc = document.implementation.createHTMLDocument(); | |
| 26 | |
| 27 let base = doc.createElement("base"); | |
| 28 doc.head.appendChild(base); | |
|
Wladimir Palant
2015/01/21 15:33:44
I was about to suggest using xml:base (wouldn't re
| |
| 29 | |
| 30 let anchor = doc.createElement("a"); | |
| 31 doc.body.appendChild(anchor); | |
| 32 | |
| 33 URL = function(url, baseUrl) | |
| 34 { | |
| 35 base.href = baseUrl; | |
|
Wladimir Palant
2015/01/21 15:33:44
This will stringify baseUrl, meaning typically ass
Sebastian Noack
2015/01/21 17:48:18
Done.
| |
| 36 anchor.href = url; | |
| 37 | |
| 38 for (var prop of URLproperties) | |
|
Wladimir Palant
2015/01/21 15:33:44
Nit: let prop?
Sebastian Noack
2015/01/21 17:48:18
Done.
| |
| 39 this[prop] = anchor[prop]; | |
| 40 }; | |
| 41 } | |
| 42 | |
| 43 return URL; | |
| 44 })(); | |
| OLD | NEW |