Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pagedjs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Guillaume
pagedjs
Commits
2589ab60
Commit
2589ab60
authored
Nov 26, 2019
by
Fred Chasen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'data64' into 'master'"
This reverts merge request !77
parent
0ce0fb2a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
139 deletions
+7
-139
data64.html
specs/data64/data64.html
+0
-96
data64.spec.js
specs/data64/data64.spec.js
+0
-31
sheet.js
src/polisher/sheet.js
+7
-12
No files found.
specs/data64/data64.html
deleted
100644 → 0
View file @
0ce0fb2a
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html;charset=utf-8"
/>
<title>
Data-64 for paged.js
</title>
<script
src=
"../../dist/paged.polyfill.js"
></script>
<style>
body
{
width
:
100%
;
column-count
:
2
;
}
.block
{
font-family
:
"Fira code"
,
monospace
;
margin
:
0
auto
;
width
:
80%
;
max-height
:
80%
;
box-shadow
:
0
20px
68px
rgba
(
0
,
0
,
0
,
.55
);
background-color
:
#282c34
;
border-radius
:
5px
;
color
:
#d7d3cb
;
}
.block
>
.title
{
display
:
block
;
flex-direction
:
row
;
line-height
:
1.5em
;
padding
:
0
20px
;
z-index
:
10
;
height
:
1.5em
;
min-height
:
1.5em
;
text-align
:
center
;
position
:
relative
;
}
.raw-base64
.block
>
.title
::before
{
content
:
url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCA1NCAxNCc+PGcgZmlsbD0nbm9uZScgZmlsbC1ydWxlPSdldmVub2RkJyB0cmFuc2Zvcm09J3RyYW5zbGF0ZSgxIDEpJyBzdHJva2Utd2lkdGg9Jy41Jz48Y2lyY2xlIGN4PSc2JyBjeT0nNicgcj0nNicgZmlsbD0nI0ZGNUY1Nicgc3Ryb2tlPScjRTA0NDNFJz48L2NpcmNsZT48Y2lyY2xlIGN4PScyNicgY3k9JzYnIHI9JzYnIGZpbGw9JyNGRkJEMkUnIHN0cm9rZT0nI0RFQTEyMyc+PC9jaXJjbGU+PGNpcmNsZSBjeD0nNDYnIGN5PSc2JyByPSc2JyBmaWxsPScjMjdDOTNGJyBzdHJva2U9JyMxQUFCMjknPjwvY2lyY2xlPjwvZz48L3N2Zz4=)
;
height
:
1.5em
;
width
:
36px
;
display
:
block
;
align-items
:
center
;
margin-right
:
1rem
;
position
:
absolute
;
}
.block
>
.content
{
padding
:
1rem
;
}
.string-double-quotes-svg
.block
>
.title
::before
{
content
:
url
(
"
data
:
image
/
svg
+
xml
,
<
svg
xmlns
=
'http://www.w3.org/2000/svg'
viewBox
=
'0 0 54 14'
><
g
fill
=
'none'
fill-rule
=
'evenodd'
transform
=
'translate(1 1)'
stroke-width
=
'.5'
><
circle
cx
=
'6'
cy
=
'6'
r
=
'6'
fill
=
'%23FF5F56'
stroke
=
'%23E0443E'
><
/
circle
><
circle
cx
=
'26'
cy
=
'6'
r
=
'6'
fill
=
'%23FFBD2E'
stroke
=
'%23DEA123'
><
/
circle
><
circle
cx
=
'46'
cy
=
'6'
r
=
'6'
fill
=
'%2327C93F'
stroke
=
'%231AAB29'
><
/
circle
><
/
g
><
/
svg
>"
);
height
:
1.5em
;
width
:
36px
;
display
:
block
;
align-items
:
center
;
margin-right
:
1rem
;
position
:
absolute
;
}
.string-single-quotes-svg
.block
>
.title
::before
{
content
:
url
(
'
data
:
image
/
svg
+
xml
,
<
svg
xmlns
=
"http://www.w3.org/2000/svg"
viewBox
=
"0 0 54 14"
><
g
fill
=
"none"
fill-rule
=
"evenodd"
transform
=
"translate(1 1)"
stroke-width
=
".5"
><
circle
cx
=
"6"
cy
=
"6"
r
=
"6"
fill
=
"%23FF5F56"
stroke
=
"%23E0443E"
><
/
circle
><
circle
cx
=
"26"
cy
=
"6"
r
=
"6"
fill
=
"%23FFBD2E"
stroke
=
"%23DEA123"
><
/
circle
><
circle
cx
=
"46"
cy
=
"6"
r
=
"6"
fill
=
"%2327C93F"
stroke
=
"%231AAB29"
><
/
circle
><
/
g
><
/
svg
>'
);
height
:
1.5em
;
width
:
36px
;
display
:
block
;
align-items
:
center
;
margin-right
:
1rem
;
position
:
absolute
;
}
</style>
</head>
<body>
<div
class=
"raw-base64"
>
<div
class=
"block"
>
<div
id=
"rawBase64"
class=
"title"
>
Title
</div>
<div
class=
"content"
>
console.log('hello')
</div>
</div>
</div>
<div
class=
"string-double-quotes-svg"
>
<div
class=
"block"
>
<div
id=
"stringSVGDoubleQuotes"
class=
"title"
>
Title
</div>
<div
class=
"content"
>
console.log('hello')
</div>
</div>
</div>
<div
class=
"string-single-quotes-svg"
>
<div
class=
"block"
>
<div
id=
"stringSVGSingleQuotes"
class=
"title"
>
Title
</div>
<div
class=
"content"
>
console.log('hello')
</div>
</div>
</div>
</body>
</html>
specs/data64/data64.spec.js
deleted
100644 → 0
View file @
0ce0fb2a
const
TIMEOUT
=
10000
;
// Some book might take longer than this to renderer
describe
(
"
default
"
,
()
=>
{
let
page
;
beforeAll
(
async
()
=>
{
page
=
await
loadPage
(
"
data64/data64.html
"
);
return
page
.
rendered
;
},
TIMEOUT
);
afterAll
(
async
()
=>
{
if
(
!
DEBUG
)
{
await
page
.
close
();
}
});
it
(
"
pseudo element using content with url(
\"
data:image/svg+xml,<svg>...<.svg>
\"
) function should appear
"
,
async
()
=>
{
let
data
=
await
page
.
$eval
(
"
#stringSVGDoubleQuotes
"
,
(
r
)
=>
window
.
getComputedStyle
(
r
,
"
::before
"
).
content
);
expect
(
data
).
toEqual
(
"
url(
\"
data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 54 14'><g fill='none' fill-rule='evenodd' transform='translate(1 1)' stroke-width='.5'><circle cx='6' cy='6' r='6' fill='%23FF5F56' stroke='%23E0443E'></circle><circle cx='26' cy='6' r='6' fill='%23FFBD2E' stroke='%23DEA123'></circle><circle cx='46' cy='6' r='6' fill='%2327C93F' stroke='%231AAB29'></circle></g></svg>
\"
)
"
);
});
it
(
"
pseudo element using content with url('data:image/svg+xml,<svg>...<.svg>') function should appear
"
,
async
()
=>
{
let
data
=
await
page
.
$eval
(
"
#stringSVGSingleQuotes
"
,
(
r
)
=>
window
.
getComputedStyle
(
r
,
"
::before
"
).
content
);
expect
(
data
).
toEqual
(
"
url(
\"
data:image/svg+xml,<svg xmlns=
\\\"
http://www.w3.org/2000/svg
\\\"
viewBox=
\\\"
0 0 54 14
\\\"
><g fill=
\\\"
none
\\\"
fill-rule=
\\\"
evenodd
\\\"
transform=
\\\"
translate(1 1)
\\\"
stroke-width=
\\\"
.5
\\\"
><circle cx=
\\\"
6
\\\"
cy=
\\\"
6
\\\"
r=
\\\"
6
\\\"
fill=
\\\"
%23FF5F56
\\\"
stroke=
\\\"
%23E0443E
\\\"
></circle><circle cx=
\\\"
26
\\\"
cy=
\\\"
6
\\\"
r=
\\\"
6
\\\"
fill=
\\\"
%23FFBD2E
\\\"
stroke=
\\\"
%23DEA123
\\\"
></circle><circle cx=
\\\"
46
\\\"
cy=
\\\"
6
\\\"
r=
\\\"
6
\\\"
fill=
\\\"
%2327C93F
\\\"
stroke=
\\\"
%231AAB29
\\\"
></circle></g></svg>
\"
)
"
);
});
it
(
"
pseudo element using content with url(data:image/svg+xml;base64,...) function should appear
"
,
async
()
=>
{
let
data
=
await
page
.
$eval
(
"
#rawBase64
"
,
(
r
)
=>
window
.
getComputedStyle
(
r
,
"
::before
"
).
content
);
expect
(
data
).
toEqual
(
"
url(
\"
data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCA1NCAxNCc+PGcgZmlsbD0nbm9uZScgZmlsbC1ydWxlPSdldmVub2RkJyB0cmFuc2Zvcm09J3RyYW5zbGF0ZSgxIDEpJyBzdHJva2Utd2lkdGg9Jy41Jz48Y2lyY2xlIGN4PSc2JyBjeT0nNicgcj0nNicgZmlsbD0nI0ZGNUY1Nicgc3Ryb2tlPScjRTA0NDNFJz48L2NpcmNsZT48Y2lyY2xlIGN4PScyNicgY3k9JzYnIHI9JzYnIGZpbGw9JyNGRkJEMkUnIHN0cm9rZT0nI0RFQTEyMyc+PC9jaXJjbGU+PGNpcmNsZSBjeD0nNDYnIGN5PSc2JyByPSc2JyBmaWxsPScjMjdDOTNGJyBzdHJva2U9JyMxQUFCMjknPjwvY2lyY2xlPjwvZz48L3N2Zz4=
\"
)
"
);
});
});
src/polisher/sheet.js
View file @
2589ab60
...
...
@@ -16,7 +16,7 @@ class Sheet {
this
.
hooks
.
onDeclaration
=
new
Hook
(
this
);
this
.
hooks
.
onSelector
=
new
Hook
(
this
);
this
.
hooks
.
onPseudoSelector
=
new
Hook
(
this
);
this
.
hooks
.
onContent
=
new
Hook
(
this
);
this
.
hooks
.
onImport
=
new
Hook
(
this
);
...
...
@@ -120,7 +120,7 @@ class Sheet {
this
.
hooks
.
onRule
.
trigger
(
ruleNode
,
ruleItem
,
rulelist
);
this
.
declarations
(
ruleNode
,
ruleItem
,
rulelist
);
this
.
onSelector
(
ruleNode
,
ruleItem
,
rulelist
);
}
});
}
...
...
@@ -153,8 +153,8 @@ class Sheet {
enter
:
(
selectNode
,
selectItem
,
selectList
)
=>
{
// console.log(selectNode);
this
.
hooks
.
onSelector
.
trigger
(
selectNode
,
selectItem
,
selectList
,
{
ruleNode
,
ruleItem
,
rulelist
});
if
(
selectNode
.
children
.
forEach
(
node
=>
{
if
(
node
.
type
===
"
PseudoElementSelector
"
)
{
if
(
selectNode
.
children
.
forEach
(
node
=>
{
if
(
node
.
type
===
"
PseudoElementSelector
"
)
{
csstree
.
walk
(
node
,
{
visit
:
"
PseudoElementSelector
"
,
enter
:
(
pseudoNode
,
pItem
,
pList
)
=>
{
...
...
@@ -174,14 +174,9 @@ class Sheet {
csstree
.
walk
(
ast
,
{
visit
:
"
Url
"
,
enter
:
(
node
,
item
,
list
)
=>
{
let
content
=
node
.
value
.
value
;
if
((
node
.
value
.
type
===
"
Raw
"
&&
content
.
startsWith
(
"
data:
"
))
||
(
node
.
value
.
type
===
"
String
"
&&
(
content
.
startsWith
(
"
\"
data:
"
)
||
content
.
startsWith
(
"
'data:
"
))))
{
// data-uri should not be parsed using the URL interface.
}
else
{
let
href
=
content
.
replace
(
/
[
"'
]
/g
,
""
);
let
url
=
new
URL
(
href
,
this
.
url
);
node
.
value
.
value
=
url
.
toString
();
}
let
href
=
node
.
value
.
value
.
replace
(
/
[
"'
]
/g
,
""
);
let
url
=
new
URL
(
href
,
this
.
url
);
node
.
value
.
value
=
url
.
toString
();
}
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment