Ox.URL: allow for 'string' as a span type
This commit is contained in:
parent
aa178fc551
commit
00bbbd6af9
1 changed files with 11 additions and 7 deletions
|
@ -828,13 +828,15 @@ Ox.URL = function(options) {
|
||||||
// item view
|
// item view
|
||||||
state.view = parts[0];
|
state.view = parts[0];
|
||||||
parts.shift();
|
parts.shift();
|
||||||
|
} else if (state.item && self.options.views[state.type].item.length == 1) {
|
||||||
|
state.view = self.options.views[state.type].item[0];
|
||||||
}
|
}
|
||||||
if (parts.length) {
|
if (parts.length) {
|
||||||
|
spanTypes = self.options.spanType[state.type][
|
||||||
|
!state.item ? 'list' : 'item'
|
||||||
|
];
|
||||||
if (isNumericalSpan(parts[0])) {
|
if (isNumericalSpan(parts[0])) {
|
||||||
// test for numerical span
|
// test for numerical span
|
||||||
spanTypes = self.options.spanType[state.type][
|
|
||||||
!state.item ? 'list' : 'item'
|
|
||||||
];
|
|
||||||
// if no view is given then parse the span anyway,
|
// if no view is given then parse the span anyway,
|
||||||
// but make sure the span type could match a view
|
// but make sure the span type could match a view
|
||||||
spanType = state.view
|
spanType = state.view
|
||||||
|
@ -864,11 +866,13 @@ Ox.URL = function(options) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (state.span && spanType == 'duration') {
|
if (state.span && (spanType == 'duration' || spanType == 'string')) {
|
||||||
// test duration, may modify state.span
|
// test duration or numerical string, may modify state.span
|
||||||
self.options.getSpan(state, state.span, parseBeyondSpan);
|
self.options.getSpan(state, state.span, parseBeyondSpan);
|
||||||
} else if (!state.span && /^[A-Z@]/.test(parts[0])) {
|
} else if (!state.span && (
|
||||||
// test for span id or name
|
spanTypes[state.view] == 'string' || /^[A-Z@]/.test(parts[0])
|
||||||
|
)) {
|
||||||
|
// test for string or span id or name
|
||||||
self.options.getSpan(state, decodeValue(parts[0]), function() {
|
self.options.getSpan(state, decodeValue(parts[0]), function() {
|
||||||
// may have modified state.view and state.span
|
// may have modified state.view and state.span
|
||||||
if (state.span) {
|
if (state.span) {
|
||||||
|
|
Loading…
Reference in a new issue