Skip to content

Commit 41d2700

Browse files
committed
fix #44
1 parent 787683f commit 41d2700

6 files changed

Lines changed: 23 additions & 11 deletions

File tree

dist/regular.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2476,12 +2476,12 @@ var rules = {
24762476
if(all) return {type: 'TEXT', value: all}
24772477
}],
24782478

2479-
ENTER_TAG: [/[^\x00<>]*?(?=<)/, function(all){
2479+
ENTER_TAG: [/[^\x00]*?(?=<[\w\/\!])/, function(all){
24802480
this.enter('TAG');
24812481
if(all) return {type: 'TEXT', value: all}
24822482
}],
24832483

2484-
TEXT: [/[^\x00]+/, 'TEXT'],
2484+
TEXT: [/[^\x00]+/, 'TEXT' ],
24852485

24862486
// 2. TAG
24872487
// --------------------
@@ -3974,7 +3974,7 @@ animate.inject = function( node, refer ,direction, callback ){
39743974
* @return {[type]} [description]
39753975
*/
39763976
animate.remove = function(node, callback){
3977-
if(!node) throw new Error('node to be removed is undefined')
3977+
if(!node) return;
39783978
var count = 0;
39793979
function loop(){
39803980
count++;

dist/regular.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/helper/animate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ animate.inject = function( node, refer ,direction, callback ){
8484
* @return {[type]} [description]
8585
*/
8686
animate.remove = function(node, callback){
87-
if(!node) throw new Error('node to be removed is undefined')
87+
if(!node) return;
8888
var count = 0;
8989
function loop(){
9090
count++;

src/parser/Lexer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,12 @@ var rules = {
239239
if(all) return {type: 'TEXT', value: all}
240240
}],
241241

242-
ENTER_TAG: [/[^\x00<>]*?(?=<)/, function(all){
242+
ENTER_TAG: [/[^\x00]*?(?=<[\w\/\!])/, function(all){
243243
this.enter('TAG');
244244
if(all) return {type: 'TEXT', value: all}
245245
}],
246246

247-
TEXT: [/[^\x00]+/, 'TEXT'],
247+
TEXT: [/[^\x00]+/, 'TEXT' ],
248248

249249
// 2. TAG
250250
// --------------------

test/regular.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2474,12 +2474,12 @@ var rules = {
24742474
if(all) return {type: 'TEXT', value: all}
24752475
}],
24762476

2477-
ENTER_TAG: [/[^\x00<>]*?(?=<)/, function(all){
2477+
ENTER_TAG: [/[^\x00]*?(?=<[\w\/\!])/, function(all){
24782478
this.enter('TAG');
24792479
if(all) return {type: 'TEXT', value: all}
24802480
}],
24812481

2482-
TEXT: [/[^\x00]+/, 'TEXT'],
2482+
TEXT: [/[^\x00]+/, 'TEXT' ],
24832483

24842484
// 2. TAG
24852485
// --------------------
@@ -3972,7 +3972,7 @@ animate.inject = function( node, refer ,direction, callback ){
39723972
* @return {[type]} [description]
39733973
*/
39743974
animate.remove = function(node, callback){
3975-
if(!node) throw new Error('node to be removed is undefined')
3975+
if(!node) return;
39763976
var count = 0;
39773977
function loop(){
39783978
count++;

test/spec/browser-syntax.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,18 @@ void function(){
166166

167167
})
168168

169+
it("#44: <div>></div> should not throw error", function(){
170+
171+
expect(function(){
172+
new Regular({template: '<div>></div>'})
173+
}) .to.not.throwError();
174+
expect(function(){
175+
new Regular({template: '<div>><</div>'})
176+
}) .to.not.throwError();
177+
178+
})
179+
180+
169181

170182

171183

0 commit comments

Comments
 (0)