Backtestsvuerun-20261021-133314#14403
Preserve input values entered during hydration
Our patch was judged better than the merged fix.
In this judgment, Patch A = our agent, Patch B = the merged fix.
Both patches use the same detection idea (directive `created` running on an element that already has a parentNode means hydration) and both defer the decision to `mounted`, which correctly covers the Suspense/async-deps case. The difference is coverage. Patch B only preserves input when `el.type` is exactly 'text' or 'textarea', so a v-model on type=email, password, number, search, url or tel is still reset after hydration, and checkboxes, radios and selects are untouched. The issue is about inputs and forms generally, and the independent tests confirm B still fails for email, checkbox and select while A passes all of them. B's `mounted` also calls `castValue(el.value, trim, number)` without the `type === 'number'` fallback that `created` uses, so a `<input type=number v-model>` would sync a string instead of a number. Patch A handles vModelText (with a cloned-node probe to distinguish browser sanitization from user input, e.g. color lowercasing and range clamping), vModelCheckbox (including shared array/Set models across several checkboxes synced in the same tick), vModelRadio and vModelSelect (single and multiple, with correct default-selection logic). Its test suite is substantial and targeted: typed text, modifiers, textarea, dynamic type, untouched inputs, boolean and true/false-value checkboxes, multiple checkboxes, radio, select single/multiple, sanitized values, and input during pending async hydration. A is considerably larger and the per-tick `hydrationModelValues` map for shared checkbox models is somewhat intricate, but it is scoped to the hydration path, documented, and exercised by tests. B's single test covers only the narrowest case. On correctness and tests A clearly wins; its extra breadth is in service of the issue rather than unrelated churn.
Four judges ruled on this ticket in parallel, and the verdict comes from counting their votes. Each saw the issue and the two patches, labelled A and B in random order (two of them saw ours as A), with issue links and version numbers removed. Where tests could check the fix, they also saw the results of tests a separate agent wrote for the issue, run on both patches. None was told which patch was ours. The reasoning above is one judge's, shown verbatim.
Solve
13m 57s
Wall-clock time in the container
Full test suite
No new failures
1,772 passed · 1 skipped · 1,773 total
Contamination audit
Clean
No sign the agent saw the real fix
Patch size
505vs 50 merged
Changed lines, ours vs merged
The issue
View on GitHubVue version
3.5.27
Link to minimal reproduction
https://github.com/nuxt/nuxt/issues/29206
Steps to reproduce
user loads a page with a slow internet connection
starts entering some values into the input with v-model
after all browser resources loaded - input v-model reset to default value
What is expected?
entered input value is preserved once hydration completes
What is actually happening?
input value is reset to its default value
System Info
Any additional comments?
This is affecting UX when interacting with inputs/forms in slowly loading apps, where values entered during hydration phase are erased and the progress is lost. I have been blocking all forms myself until mounted hook fires to workaround this issue - it would be great to not have to!
The two patches
packages/runtime-core/__tests__/hydration.spec.tsindex 537ba236c..7ce848229 100644@@ -2941,4 +2941,247 @@ describe('SSR hydration', () => { expect(el.getAttribute('value')).toBe('server') }) })++ describe('preserve v-model user input during hydration', () => {+ async function hydrateAfterInput(+ template: string,+ data: () => Record<string, any>,+ simulateInput: (container: HTMLElement) => void,+ ) {+ let vm: any+ const App = defineComponent({+ data,+ template,+ mounted() {+ vm = this+ },+ })+ const container = document.createElement('div')+ container.innerHTML = await renderToString(h(App))+ // user interacts with the server-rendered page before hydration+ simulateInput(container)+ createSSRApp(App).mount(container)+ await nextTick()+ return { container, vm }+ }++ test('text input', async () => {+ const { container, vm } = await hydrateAfterInput(+ `<input v-model="text">`,+ () => ({ text: 'foo' }),+ c => (c.querySelector('input')!.value = 'typed'),+ )+ expect(container.querySelector('input')!.value).toBe('typed')+ expect(vm.text).toBe('typed')+ })++ test('text input with number/trim modifiers', async () => {+ const { container, vm } = await hydrateAfterInput(+ `<input class="n" v-model.number="num"><input class="t" v-model.trim="str">`,+ () => ({ num: 1, str: 'a' }),+ c => {+ c.querySelector<HTMLInputElement>('.n')!.value = '42'+ c.querySelector<HTMLInputElement>('.t')!.value = ' b '+ },+ )+ expect(vm.num).toBe(42)+ expect(vm.str).toBe('b')+ expect(container.querySelector<HTMLInputElement>('.n')!.value).toBe('42')+ })++ test('textarea', async () => {+ const { container, vm } = await hydrateAfterInput(+ `<textarea v-model="text"></textarea>`,+ () => ({ text: 'foo' }),+ c => (c.querySelector('textarea')!.value = 'typed'),+ )+ expect(container.querySelector('textarea')!.value).toBe('typed')+ expect(vm.text).toBe('typed')+ })++ test('dynamic type input', async () => {+ const { container, vm } = await hydrateAfterInput(+ `<input :type="type" v-model="text">`,+ () => ({ type: 'text', text: 'foo' }),+ c => (c.querySelector('input')!.value = 'typed'),+ )+ expect(container.querySelector('input')!.value).toBe('typed')+ expect(vm.text).toBe('typed')+ })++ test('untouched inputs still use the model value', async () => {+ const { container, vm } = await hydrateAfterInput(+ `<input class="a" v-model="text"><input class="b" type="range" v-model="range">`,+ () => ({ text: 'foo', range: null }),+ () => {},+ )+ expect(container.querySelector<HTMLInputElement>('.a')!.value).toBe('foo')+ expect(vm.text).toBe('foo')+ expect(vm.range).toBe(null)+ })++ test('checkbox (boolean)', async () => {+ const { container, vm } = await hydrateAfterInput(+ `<input type="checkbox" v-model="checked">`,+ () => ({ checked: false }),+ c => (c.querySelector('input')!.checked = true),+ )+ expect(container.querySelector('input')!.checked).toBe(true)+ expect(vm.checked).toBe(true)+ })++ test('checkbox with true-value / false-value', async () => {+ const { container, vm } = await hydrateAfterInput(+ `<input type="checkbox" v-model="val" true-value="yes" false-value="no">`,+ () => ({ val: 'yes' }),+ c => (c.querySelector('input')!.checked = false),+ )+ expect(container.querySelector('input')!.checked).toBe(false)+ expect(vm.val).toBe('no')+ })++ test('multiple checkboxes sharing an array model', async () => {+ const { container, vm } = await hydrateAfterInput(+ `<input type="checkbox" class="a" value="a" v-model="list">` ++ `<input type="checkbox" class="b" value="b" v-model="list">` ++ `<input type="checkbox" class="c" value="c" v-model="list">`,+ () => ({ list: ['c'] }),+ c => {+ c.querySelector<HTMLInputElement>('.a')!.checked = true+ c.querySelector<HTMLInputElement>('.b')!.checked = true+ c.querySelector<HTMLInputElement>('.c')!.checked = false+ },+ )+ expect(vm.list).toEqual(['a', 'b'])+ expect(container.querySelector<HTMLInputElement>('.a')!.checked).toBe(+ true,+ )+ expect(container.querySelector<HTMLInputElement>('.b')!.checked).toBe(+ true,+ )+ expect(container.querySelector<HTMLInputElement>('.c')!.checked).toBe(+ false,+ )+ })++ test('radio', async () => {+ const { container, vm } = await hydrateAfterInput(+ `<input type="radio" name="r" class="a" value="a" v-model="picked">` ++ `<input type="radio" name="r" class="b" value="b" v-model="picked">`,+ () => ({ picked: 'a' }),+ c => (c.querySelector<HTMLInputElement>('.b')!.checked = true),+ )+ expect(vm.picked).toBe('b')+ expect(container.querySelector<HTMLInputElement>('.a')!.checked).toBe(+ false,+ )+ expect(container.querySelector<HTMLInputElement>('.b')!.checked).toBe(+ true,+ )+ })++ test('select', async () => {+ const { container, vm } = await hydrateAfterInput(+ `<select v-model="selected"><option>a</option><option>b</option></select>`,+ () => ({ selected: 'a' }),+ c => (c.querySelector('select')!.value = 'b'),+ )+ expect(container.querySelector('select')!.value).toBe('b')+ expect(vm.selected).toBe('b')+ })++ test('select without a server-selected option', async () => {+ const { container, vm } = await hydrateAfterInput(+ `<select v-model="selected"><option>a</option><option>b</option></select>`,+ () => ({ selected: null }),+ () => {},+ )+ // the browser selects the first option by default, which is not user input+ expect(vm.selected).toBe(null)+ expect(container.querySelector('select')!.selectedIndex).toBe(-1)+ })++ test('select multiple', async () => {+ const { container, vm } = await hydrateAfterInput(+ `<select multiple v-model="selected"><option>a</option><option>b</option><option>c</option></select>`,+ () => ({ selected: ['a'] }),+ c => {+ const options = c.querySelector('select')!.options+ options[0].selected = false+ options[1].selected = true+ options[2].selected = true+ },+ )+ expect(vm.selected).toEqual(['b', 'c'])+ const options = container.querySelector('select')!.options+ expect([...options].map(o => o.selected)).toEqual([false, true, true])+ })++ test('value sanitized by the browser is not user input', async () => {+ const { container, vm } = await hydrateAfterInput(+ `<input type="color" v-model="color">`,+ () => ({ color: '#FF0000' }),+ () => {},+ )+ expect(container.querySelector('input')!.value).toBe('#ff0000')+ expect(vm.color).toBe('#FF0000')+ })++ test('input entered while hydration is pending on async deps', async () => {+ let resolve: () => void+ const promise = new Promise<void>(r => (resolve = r))+ const AsyncChild = defineComponent({+ async setup() {+ await promise+ return () => h('span')+ },+ })+ const text = ref('foo')+ const checked = ref(false)+ const selected = ref('a')+ const App = defineComponent({+ components: { AsyncChild },+ setup: () => ({ text, checked, selected }),+ template:+ `<Suspense><div><input class="t" v-model="text">` ++ `<input type="checkbox" class="c" v-model="checked">` ++ `<select v-model="selected"><option>a</option><option>b</option></select>` ++ `<AsyncChild/></div></Suspense>`,+ })+ const container = document.createElement('div')+ resolve!()+ container.innerHTML = await renderToString(h(App))++ let resolveClient: () => void+ const clientPromise = new Promise<void>(r => (resolveClient = r))+ AsyncChild.setup = async () => {+ await clientPromise+ return () => h('span')+ }+ createSSRApp(App).mount(container)++ // user interacts with the already listening, but not yet mounted inputs+ const input = container.querySelector<HTMLInputElement>('.t')!+ input.value = 'typed'+ input.dispatchEvent(new Event('input'))+ const checkbox = container.querySelector<HTMLInputElement>('.c')!+ checkbox.checked = true+ checkbox.dispatchEvent(new Event('change'))+ const select = container.querySelector('select')!+ select.value = 'b'+ select.dispatchEvent(new Event('change'))+ await nextTick()++ resolveClient!()+ await new Promise(r => setTimeout(r))+ await nextTick()++ expect(input.value).toBe('typed')+ expect(text.value).toBe('typed')+ expect(checkbox.checked).toBe(true)+ expect(checked.value).toBe(true)+ expect(select.value).toBe('b')+ expect(selected.value).toBe('b')+ })+ }) })packages/runtime-dom/src/directives/vModel.tsindex 766db6bfe..2bdc44045 100644@@ -40,11 +40,44 @@ function onCompositionEnd(e: Event) { const assignKey: unique symbol = Symbol('_assign') type ModelDirective<T, Modifiers extends string = string> = ObjectDirective<- T & { [assignKey]: AssignerFn; _assigning?: boolean },+ T & {+ [assignKey]: AssignerFn+ _assigning?: boolean+ _hydrating?: boolean+ _hydrationUserInput?: boolean+ }, any, Modifiers > +/**+ * During a client-side mount, directive `created` hooks run before the element+ * is inserted into its parent. During hydration the element already lives in+ * the server-rendered DOM, where the user may have interacted with it before+ * the app finished loading.+ */+function isHydrating(el: Element): boolean {+ return !!el.parentNode+}++/**+ * Whether the user changed the value of a server-rendered text-like input or+ * textarea before hydration, i.e. its current value no longer matches the+ * value rendered by the server.+ */+function hasUserValue(el: HTMLInputElement | HTMLTextAreaElement): boolean {+ if (el.value === el.defaultValue) return false+ if (el.tagName === 'TEXTAREA') return true+ // e.g. custom elements+ if (el.tagName !== 'INPUT') return false+ // the browser sanitizes the server-rendered value (e.g. lowercases colors,+ // clamps ranges, strips line breaks or falls back to the midpoint of a range+ // without a value), which was never entered by the user+ const probe = el.cloneNode() as HTMLInputElement+ probe.value = el.defaultValue+ return el.value !== probe.value+}+ function castValue(value: string, trim?: boolean, number?: boolean | null) { if (trim) value = value.trim() if (number) value = looseToNumber(value)@@ -61,6 +94,9 @@ export const vModelText: ModelDirective< el[assignKey] = getModelAssigner(vnode) const castToNumber = number || (vnode.props && vnode.props.type === 'number')+ // the value entered by the user before hydration completed is preserved+ // and synced to the model in `mounted`+ el._hydrating = isHydrating(el) addEventListener(el, lazy ? 'change' : 'input', e => { if ((e.target as any).composing) return el[assignKey](castValue(el.value, trim, castToNumber))@@ -81,7 +117,21 @@ export const vModelText: ModelDirective< } }, // set value on mounted so it's after min/max for type="range"- mounted(el, { value }) {+ mounted(el, { value, modifiers: { trim, number } }, vnode) {+ // checked in `mounted` as it may be delayed by async deps (e.g. <Suspense>)+ // while the server-rendered element is already interactive+ const hydrating = el._hydrating+ el._hydrating = false+ if (hydrating && hasUserValue(el)) {+ el[assignKey](+ castValue(+ el.value,+ trim,+ number || (vnode.props && vnode.props.type === 'number'),+ ),+ )+ return+ } el.value = value == null ? '' : value }, beforeUpdate(@@ -126,42 +176,96 @@ export const vModelCheckbox: ModelDirective<HTMLInputElement> = { deep: true, created(el, _, vnode) { el[assignKey] = getModelAssigner(vnode)+ // the checked state toggled by the user before hydration completed is+ // preserved and synced to the model in `mounted`+ el._hydrating = isHydrating(el) addEventListener(el, 'change', () => {- const modelValue = (el as any)._modelValue- const elementValue = getValue(el)- const checked = el.checked- const assign = el[assignKey]- if (isArray(modelValue)) {- const index = looseIndexOf(modelValue, elementValue)- const found = index !== -1- if (checked && !found) {- assign(modelValue.concat(elementValue))- } else if (!checked && found) {- const filtered = [...modelValue]- filtered.splice(index, 1)- assign(filtered)- }- } else if (isSet(modelValue)) {- const cloned = new Set(modelValue)- if (checked) {- cloned.add(elementValue)- } else {- cloned.delete(elementValue)- }- assign(cloned)- } else {- assign(getCheckboxValue(el, checked))- }+ assignCheckboxValue(el, (el as any)._modelValue) }) }, // set initial checked on mount to wait for true-value/false-value- mounted: setChecked,+ mounted(el, binding, vnode) {+ const hydrating = el._hydrating+ el._hydrating = false+ if (hydrating && el.checked !== el.defaultChecked) {+ ;(el as any)._modelValue = binding.value+ // multiple checkboxes may share the same array / Set model and are all+ // synced in the same tick, before the re-render updates `_modelValue`+ const modelValue = resolveHydrationModelValue(binding.value)+ const newValue = assignCheckboxValue(el, modelValue)+ if (newValue !== modelValue) {+ trackHydrationModelValue(modelValue, newValue)+ }+ return+ }+ setChecked(el, binding, vnode)+ }, beforeUpdate(el, binding, vnode) { el[assignKey] = getModelAssigner(vnode) setChecked(el, binding, vnode) }, } +/**+ * Assigns the model value derived from the checkbox's current checked state.+ * Returns the assigned value, or the original model value if unchanged.+ */+function assignCheckboxValue(+ el: HTMLInputElement & { [assignKey]: AssignerFn },+ modelValue: any,+): any {+ const elementValue = getValue(el)+ const checked = el.checked+ const assign = el[assignKey]+ let newValue = modelValue+ if (isArray(modelValue)) {+ const index = looseIndexOf(modelValue, elementValue)+ const found = index !== -1+ if (checked && !found) {+ assign((newValue = modelValue.concat(elementValue)))+ } else if (!checked && found) {+ const filtered = [...modelValue]+ filtered.splice(index, 1)+ assign((newValue = filtered))+ }+ } else if (isSet(modelValue)) {+ const cloned = new Set(modelValue)+ if (checked) {+ cloned.add(elementValue)+ } else {+ cloned.delete(elementValue)+ }+ assign((newValue = cloned))+ } else {+ assign((newValue = getCheckboxValue(el, checked)))+ }+ return newValue+}++// array / Set model values replaced while syncing user input preserved during+// hydration, mapped to their replacements. Cleared once the current tick ends.+let hydrationModelValues: Map<any, any> | null = null++function trackHydrationModelValue(oldValue: any, newValue: any) {+ if (!isArray(oldValue) && !isSet(oldValue)) return+ if (!hydrationModelValues) {+ hydrationModelValues = new Map()+ nextTick(() => {+ hydrationModelValues = null+ })+ }+ hydrationModelValues.set(oldValue, newValue)+}++function resolveHydrationModelValue(value: any): any {+ if (hydrationModelValues) {+ while (hydrationModelValues.has(value)) {+ value = hydrationModelValues.get(value)+ }+ }+ return value+}+ function setChecked( el: HTMLInputElement, { value, oldValue }: DirectiveBinding,@@ -189,12 +293,24 @@ function setChecked( export const vModelRadio: ModelDirective<HTMLInputElement> = { created(el, { value }, vnode) {- el.checked = looseEqual(value, vnode.props!.value)+ if (isHydrating(el) && el.checked !== el.defaultChecked) {+ // preserve the radio selected by the user before hydration completed.+ // the newly checked radio syncs its value to the model in `mounted`+ if (el.checked) el._hydrationUserInput = true+ } else {+ el.checked = looseEqual(value, vnode.props!.value)+ } el[assignKey] = getModelAssigner(vnode) addEventListener(el, 'change', () => { el[assignKey](getValue(el)) }) },+ mounted(el) {+ if (el._hydrationUserInput) {+ el._hydrationUserInput = false+ el[assignKey](getValue(el))+ }+ }, beforeUpdate(el, { value, oldValue }, vnode) { el[assignKey] = getModelAssigner(vnode) if (value !== oldValue) {@@ -208,29 +324,23 @@ export const vModelSelect: ModelDirective<HTMLSelectElement, 'number'> = { deep: true, created(el, { value, modifiers: { number } }, vnode) { ;(el as any)._modelValue = value+ // the options selected by the user before hydration completed are+ // preserved and synced to the model in `mounted`+ el._hydrating = isHydrating(el) addEventListener(el, 'change', () => {- const selectedVal = Array.prototype.filter- .call(el.options, (o: HTMLOptionElement) => o.selected)- .map((o: HTMLOptionElement) =>- number ? looseToNumber(getValue(o)) : getValue(o),- )- el[assignKey](- el.multiple- ? isSet((el as any)._modelValue)- ? new Set(selectedVal)- : selectedVal- : selectedVal[0],- )- el._assigning = true- nextTick(() => {- el._assigning = false- })+ assignSelectValue(el, number) }) el[assignKey] = getModelAssigner(vnode) }, // set value in mounted & updated because <select> relies on its children // <option>s.- mounted(el, { value }) {+ mounted(el, { value, modifiers: { number } }) {+ const hydrating = el._hydrating+ el._hydrating = false+ if (hydrating && hasUserSelection(el)) {+ assignSelectValue(el, number)+ return+ } setSelected(el, value) }, beforeUpdate(el, { value }, vnode) {@@ -244,6 +354,66 @@ export const vModelSelect: ModelDirective<HTMLSelectElement, 'number'> = { }, } +function assignSelectValue(+ el: HTMLSelectElement & { [assignKey]: AssignerFn; _assigning?: boolean },+ number: boolean | undefined,+) {+ const selectedVal = Array.prototype.filter+ .call(el.options, (o: HTMLOptionElement) => o.selected)+ .map((o: HTMLOptionElement) =>+ number ? looseToNumber(getValue(o)) : getValue(o),+ )+ el[assignKey](+ el.multiple+ ? isSet((el as any)._modelValue)+ ? new Set(selectedVal)+ : selectedVal+ : selectedVal[0],+ )+ el._assigning = true+ nextTick(() => {+ el._assigning = false+ })+}++/**+ * Whether the user changed the selection of a server-rendered <select> before+ * hydration, i.e. the selected options no longer match the server-rendered+ * `selected` attributes.+ */+function hasUserSelection(el: HTMLSelectElement): boolean {+ const options = el.options+ if (el.multiple) {+ for (let i = 0; i < options.length; i++) {+ if (options[i].selected !== options[i].defaultSelected) return true+ }+ return false+ }+ // the last option with a `selected` attribute is selected by default+ let defaultIndex = -1+ for (let i = 0; i < options.length; i++) {+ if (options[i].defaultSelected) defaultIndex = i+ }+ // without any, a drop-down <select> selects its first enabled option+ if (defaultIndex === -1 && el.size <= 1) {+ for (let i = 0; i < options.length; i++) {+ if (!isOptionDisabled(options[i])) {+ defaultIndex = i+ break+ }+ }+ }+ return el.selectedIndex !== defaultIndex+}++function isOptionDisabled(option: HTMLOptionElement): boolean {+ const parent = option.parentNode as HTMLOptGroupElement | null+ return (+ option.disabled ||+ (!!parent && parent.nodeName === 'OPTGROUP' && parent.disabled)+ )+}+ function setSelected(el: HTMLSelectElement, value: any) { const isMultiple = el.multiple const isArrayValue = isArray(value)
packages/runtime-core/__tests__/hydration.spec.tsindex 537ba236c..49c39bdd6 100644@@ -1692,6 +1692,24 @@ describe('SSR hydration', () => { expect((container.firstChild as any)._trueValue).toBe(true) }) + test('preserves text entered before v-model hydration', async () => {+ const state = reactive({ text: 'server value' })+ const App = {+ setup: () => state,+ template: `<input v-model="text">`,+ }+ const container = document.createElement('div')+ container.innerHTML = await renderToString(h(App))+ const input = container.firstChild as HTMLInputElement+ input.value = 'user value'++ createSSRApp(App).mount(container)+ await nextTick()++ expect(input.value).toBe('user value')+ expect(state.text).toBe('user value')+ })+ test('force hydrate checkbox with indeterminate', () => { const { container } = mountWithHydration( '<input type="checkbox" indeterminate>',packages/runtime-dom/src/directives/vModel.tsindex 766db6bfe..eeb248f28 100644@@ -38,9 +38,14 @@ function onCompositionEnd(e: Event) { } const assignKey: unique symbol = Symbol('_assign')+const initialValueKey: unique symbol = Symbol('_initialValue') type ModelDirective<T, Modifiers extends string = string> = ObjectDirective<- T & { [assignKey]: AssignerFn; _assigning?: boolean },+ T & {+ [assignKey]: AssignerFn+ [initialValueKey]?: string+ _assigning?: boolean+ }, any, Modifiers >@@ -58,6 +63,16 @@ export const vModelText: ModelDirective< 'trim' | 'number' | 'lazy' > = { created(el, { modifiers: { lazy, trim, number } }, vnode) {+ // During hydration, created runs on an element already in the DOM.+ if (el.parentNode) {+ if (el.type === 'text') {+ // Text inputs strip CR/LF from value, while defaultValue retains them.+ el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, '')+ } else if (el.type === 'textarea') {+ // Textareas normalize CRLF/CR to LF in value.+ el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, '\n')+ }+ } el[assignKey] = getModelAssigner(vnode) const castToNumber = number || (vnode.props && vnode.props.type === 'number')@@ -81,8 +96,19 @@ export const vModelText: ModelDirective< } }, // set value on mounted so it's after min/max for type="range"- mounted(el, { value }) {- el.value = value == null ? '' : value+ mounted(el, { value, modifiers: { trim, number } }) {+ const newValue = value == null ? '' : value+ const initialValue = el[initialValueKey]+ delete el[initialValueKey]+ if (+ initialValue !== undefined &&+ (el.type === 'text' || el.type === 'textarea') &&+ el.value !== initialValue+ ) {+ el[assignKey](castValue(el.value, trim, number))+ } else {+ el.value = newValue+ } }, beforeUpdate( el,