File tree 6 files changed +9
-41
lines changed
6 files changed +9
-41
lines changed Original file line number Diff line number Diff line change @@ -42,12 +42,10 @@ module.exports = function (grunt) {
42
42
files : [
43
43
'test/unit/lib/jquery.js' ,
44
44
'src/**/*.js' ,
45
- 'test/unit/lib/indoc_patch.js' ,
46
45
'test/unit/specs/**/*.js'
47
46
] ,
48
47
preprocessors : {
49
48
'src/**/*.js' : [ 'commonjs' ] ,
50
- 'test/unit/lib/indoc_patch.js' : [ 'commonjs' ] ,
51
49
'test/unit/specs/**/*.js' : [ 'commonjs' ]
52
50
} ,
53
51
singleRun : true
@@ -64,7 +62,6 @@ module.exports = function (grunt) {
64
62
reporters : [ 'progress' , 'coverage' ] ,
65
63
preprocessors : {
66
64
'src/**/*.js' : [ 'commonjs' , 'coverage' ] ,
67
- 'test/unit/lib/indoc_patch.js' : [ 'commonjs' ] ,
68
65
'test/unit/specs/**/*.js' : [ 'commonjs' ]
69
66
} ,
70
67
coverageReporter : {
Original file line number Diff line number Diff line change @@ -2,8 +2,11 @@ var config = require('../config')
2
2
3
3
/**
4
4
* Check if a node is in the document.
5
- * Note: document.documentElement.contains should work here but doesn't seem to
6
- * work properly in phantom.js making unit testing difficult.
5
+ * Note: document.documentElement.contains should work here
6
+ * but always returns false for comment nodes in phantomjs,
7
+ * making unit tests difficult. This is fixed byy doing the
8
+ * contains() check on the node's parentNode instead of
9
+ * the node itself.
7
10
*
8
11
* @param {Node } node
9
12
* @return {Boolean }
@@ -14,13 +17,10 @@ var doc =
14
17
document . documentElement
15
18
16
19
exports . inDoc = function ( node ) {
17
- var adown = doc . nodeType === 9 ? doc . documentElement : doc
18
- var bup = node && node . parentNode
19
- return doc === bup || ! ! ( bup && bup . nodeType === 1 && (
20
- adown . contains
21
- ? adown . contains ( bup )
22
- : doc . compareDocumentPosition && doc . compareDocumentPosition ( bup ) & 16
23
- ) ) ;
20
+ var parent = node && node . parentNode
21
+ return doc === node ||
22
+ doc === parent ||
23
+ ! ! ( parent && parent . nodeType === 1 && ( doc . contains ( parent ) ) )
24
24
}
25
25
26
26
/**
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- // patch inDoc
2
- require ( '../../lib/indoc_patch' )
3
1
var _ = require ( '../../../../src/util' )
4
2
var Vue = require ( '../../../../src/vue' )
5
3
Original file line number Diff line number Diff line change 1
- // patch inDoc
2
- require ( '../../lib/indoc_patch' )
3
1
var _ = require ( '../../../../src/util' )
4
2
var Vue = require ( '../../../../src/vue' )
5
3
Original file line number Diff line number Diff line change 1
- // patch inDoc
2
- require ( '../lib/indoc_patch' )
3
1
// test cases for edge cases & bug fixes
4
2
var Vue = require ( '../../../src/vue' )
5
3
You can’t perform that action at this time.
0 commit comments