FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
frontend/static/src/javascripts/lib/$.js at 143-sonobi-render · devhttps/frontend · GitHub
devhttps
/
frontend
Public
forked from
guardian/frontend
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
frontend
/
static
/
src
/
javascripts
/
lib
/
$.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (36 loc) · 1.13 KB
Breadcrumbs
frontend
/
static
/
src
/
javascripts
/
lib
/
$.js
Copy path
File metadata and controls
42 lines (36 loc) · 1.13 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
@flow
import
bonzo
from
'bonzo'
;
import
qwery
from
'qwery'
;
// Warning: side effect. This patches the bonzo module for use everywhere
bonzo
.
aug
(
{
height
(
)
{
return
this
.
dim
(
)
.
height
;
}
,
}
)
;
// #? Use of `Node` throughout this file may need a second look?
const
$
=
(
selector
: ?
string
|
?
Node
,
context
: ?
Node
|
?
string
)
:
bonzo
=>
bonzo
(
qwery
(
selector
,
context
)
)
;
$
.
create
=
(
s
:
string
|
Node
)
:
bonzo
=>
bonzo
(
bonzo
.
create
(
s
)
)
;
// #? duplicated in lib/closest.js?
$
.
ancestor
=
(
el
: ?
Node
,
className
:
string
)
: ?
Node
=>
{
if
(
el
===
null
||
el
===
undefined
||
el
.
nodeName
.
toLowerCase
(
)
===
'html'
)
{
return
null
;
}
if
(
!
el
.
parentNode
||
bonzo
(
el
.
parentNode
)
.
hasClass
(
className
)
)
{
return
el
.
parentNode
;
}
return
$
.
ancestor
(
el
.
parentNode
,
className
)
;
}
;
// #? does this offer any value?
$
.
forEachElement
=
(
selector
:
string
,
fn
:
Function
)
:
Array
<
Element
>
=>
{
const
els
=
qwery
(
selector
)
;
els
.
forEach
(
fn
)
;
return
els
;
}
;
// #es6 can be named exports once we're es6-only
// eslint-disable-next-line guardian-frontend/no-default-export
export
default
$
;
Back
|
FazBrowse Home
|
New Git URL