OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 replace(/\.\d+/, function(m) { | 200 replace(/\.\d+/, function(m) { |
201 return m.replace(/0+$/, ''); | 201 return m.replace(/0+$/, ''); |
202 }). | 202 }). |
203 replace(/\.$/, ''). | 203 replace(/\.$/, ''). |
204 replace(/^-0$/, '0'); | 204 replace(/^-0$/, '0'); |
205 }); | 205 }); |
206 } | 206 } |
207 | 207 |
208 var anchor = document.createElement('a'); | 208 var anchor = document.createElement('a'); |
209 function sanitizeUrls(value) { | 209 function sanitizeUrls(value) { |
210 var matches = value.match(/url\([^\)]*\)/g); | 210 var matches = value.match(/url\([^\)]*\)/g); |
Timothy Loh
2015/09/28 06:18:13
should update this too
nainar
2015/09/28 07:22:54
Done.
| |
211 if (matches !== null) { | 211 if (matches !== null) { |
212 for (var i = 0; i < matches.length; ++i) { | 212 for (var i = 0; i < matches.length; ++i) { |
213 var url = /url\(([^\)]*)\)/g.exec(matches[i])[1]; | 213 var url = /url\(("|')([^\)]*)('|")\)/g.exec(matches[i])[2]; |
Timothy Loh
2015/09/28 06:18:13
does this work with just "? Otherwise it'd be bett
nainar
2015/09/28 07:22:54
Done.
| |
214 anchor.href = url; | 214 anchor.href = url; |
215 anchor.pathname = '...' + anchor.pathname.substring(anchor.pathname.last IndexOf('/')); | 215 anchor.pathname = '...' + anchor.pathname.substring(anchor.pathname.last IndexOf('/')); |
216 value = value.replace(matches[i], 'url(' + anchor.href + ')'); | 216 value = value.replace(matches[i], 'url(' + anchor.href + ')'); |
217 } | 217 } |
218 } | 218 } |
219 return value; | 219 return value; |
220 } | 220 } |
221 | 221 |
222 function normalizeValue(value) { | 222 function normalizeValue(value) { |
223 return roundNumbers(sanitizeUrls(value)). | 223 return roundNumbers(sanitizeUrls(value)). |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
407 loadScript('../../resources/testharness.js').then(function() { | 407 loadScript('../../resources/testharness.js').then(function() { |
408 return loadScript('../../resources/testharnessreport.js'); | 408 return loadScript('../../resources/testharnessreport.js'); |
409 }).then(function() { | 409 }).then(function() { |
410 var asyncHandle = async_test('This test uses interpolation-test.js.') | 410 var asyncHandle = async_test('This test uses interpolation-test.js.') |
411 requestAnimationFrame(function() { | 411 requestAnimationFrame(function() { |
412 runTests(); | 412 runTests(); |
413 asyncHandle.done() | 413 asyncHandle.done() |
414 }); | 414 }); |
415 }); | 415 }); |
416 })(); | 416 })(); |
OLD | NEW |