Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
357955c2
Commit
357955c2
authored
Feb 26, 2015
by
csillag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update d-t-m to ed0a7a85 (master branch)
This brings bugfixes for infinite loop on FF. Fixes 1983.
parent
ff95bd63
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
dom_text_mapper.js
h/static/scripts/vendor/dom_text_mapper.js
+10
-4
No files found.
h/static/scripts/vendor/dom_text_mapper.js
View file @
357955c2
...
...
@@ -5,7 +5,7 @@
__indexOf
=
[].
indexOf
||
function
(
item
)
{
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
)
{
if
(
i
in
this
&&
this
[
i
]
===
item
)
return
i
;
}
return
-
1
;
};
window
.
DomTextMapper
=
(
function
()
{
var
CONTEXT_LEN
,
SELECT_CHILDREN_INSTEAD
,
USE_EMPTY_TEXT_WORKAROUND
,
USE_TABLE_TEXT_WORKAROUND
,
WHITESPACE
;
var
CONTEXT_LEN
,
SELECT_CHILDREN_INSTEAD
,
USE_EMPTY_TEXT_WORKAROUND
,
USE_TABLE_TEXT_WORKAROUND
,
WHITESPACE
,
WHITESPACE_REGEX
;
DomTextMapper
.
applicable
=
function
()
{
return
true
;
...
...
@@ -19,6 +19,8 @@
CONTEXT_LEN
=
32
;
WHITESPACE_REGEX
=
/
\s
+/g
;
DomTextMapper
.
instances
=
0
;
function
DomTextMapper
(
id
)
{
...
...
@@ -649,7 +651,7 @@
DomTextMapper
.
prototype
.
readSelectionText
=
function
(
sel
)
{
sel
||
(
sel
=
this
.
rootWin
.
getSelection
());
return
sel
.
toString
().
trim
().
replace
(
/
\n
/g
,
" "
).
replace
(
/
\s{2,}
/g
,
" "
);
return
sel
.
toString
().
trim
().
replace
(
WHITESPACE_REGEX
,
' '
);
};
DomTextMapper
.
prototype
.
getNodeSelectionText
=
function
(
node
,
shouldRestoreSelection
)
{
...
...
@@ -670,8 +672,8 @@
DomTextMapper
.
prototype
.
computeSourcePositions
=
function
(
match
)
{
var
dc
,
displayEnd
,
displayIndex
,
displayStart
,
displayText
,
sc
,
sourceEnd
,
sourceIndex
,
sourceStart
,
sourceText
;
sourceText
=
match
.
element
.
node
.
data
.
replace
(
/
\n
/g
,
" "
);
displayText
=
match
.
element
.
content
;
sourceText
=
match
.
element
.
node
.
data
.
replace
(
WHITESPACE_REGEX
,
" "
);
displayText
=
match
.
element
.
content
.
replace
(
WHITESPACE_REGEX
,
" "
)
;
displayStart
=
match
.
start
!=
null
?
match
.
start
:
0
;
displayEnd
=
match
.
end
!=
null
?
match
.
end
:
displayText
.
length
;
if
(
displayEnd
===
0
)
{
...
...
@@ -692,6 +694,8 @@
if
(
displayIndex
===
displayEnd
)
{
sourceEnd
=
sourceIndex
+
1
;
}
}
else
if
((
sc
==
null
)
||
(
dc
==
null
))
{
throw
new
Error
(
"display and source text mismatch: '"
+
sourceText
+
"' vs. '"
+
displayText
+
"'"
);
}
sourceIndex
++
;
}
...
...
@@ -843,3 +847,5 @@
})();
}).
call
(
this
);
//# sourceMappingURL=dom_text_mapper.map
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